v6: OffsetDateTime is serialised with toString(), which drops the seconds and is not RFC 3339
还没有人认领这个 Issue。
评估
调研方向
定位 Filter$DateOperand、InsertManyRequest.marshalValue 和 DateUtil$CustomTypeAdapterFactory$1,它们是 issue 中描述的三个序列化入口。复现 REST 插入、gRPC 批处理和日期过滤器的整分钟时间戳场景,然后验证三个路径都输出带秒的 RFC 3339 时间戳,并且写入和过滤器都接受这些时间戳。
由索引模型根据 Issue 内容生成。
描述
Summary
The client serialises OffsetDateTime with toString(), which omits the seconds when they are zero. 2024-03-01T00:00:00Z therefore goes on the wire as 2024-03-01T00:00Z, which is not RFC 3339 — partial-time requires hour ":" minute ":" second — and Weaviate rejects it.
Every timestamp on an exact minute boundary is affected, which is most timestamps written by hand. It breaks writes and filters alike.
Reproduction
OffsetDateTime round = OffsetDateTime.parse("2024-03-01T00:00:00Z");
OffsetDateTime withSeconds = OffsetDateTime.parse("2024-03-01T00:00:01Z");
System.out.println(round); // 2024-03-01T00:00Z <- the seconds are gone
System.out.println(withSeconds); // 2024-03-01T00:00:01Z
Against a collection with a single date property when:
FAIL REST insert round -> invalid date property 'when' on class 'DBeaverDateProbe':
requires a string with a RFC3339 formatted date,
but the given value is '2024-03-01T00:00Z'
OK REST insert withSeconds
FAIL gRPC batch round -> invalid date property 'when' on class 'DBeaverDateProbe':
requires a string with a RFC3339 formatted date,
but the given value is '2024-03-01T00:00Z'
OK gRPC batch withSeconds
and on the query side:
FAIL Filter.property("when").gt(round) -> trying parse time as RFC3339 string:
parsing time "2024-03-01T00:00Z" as
"2006-01-02T15:04:05Z07:00": cannot parse "Z" as ":"
OK Filter.property("when").gt(withSeconds) -> 2 rows
OK Filter.property("when").gt("2024-03-01T00:00:00Z") // String overload -> 2 rows
FAIL Filter.createdAt().gt(round) -> same parse error
OK Filter.createdAt().gt(withSeconds)
The only difference between each passing and failing pair is whether the second happens to be zero, which isolates the cause.
Where it comes from
Disassembling every non-protocol class in client6-6.3.1-all.jar and grepping for java/time/OffsetDateTime.toString gives three call sites, one per path:
| class | path | reached by |
|---|---|---|
Filter$DateOperand |
gRPC search | every date filter, plus Filter.createdAt() / Filter.lastUpdatedAt() |
InsertManyRequest.marshalValue |
gRPC batch | data.insertMany(...) — Value.newBuilder().setStringValue(dt.toString()) |
DateUtil$CustomTypeAdapterFactory$1 |
REST / Gson | data.insert(...) and object reads — JsonWriter.value(dt.toString()) |
OffsetDateTime.toString() delegates down to LocalTime.toString(), which emits HH:mm when both second and nano are zero. It is a display format, not a wire format.
Suggested fix
Format explicitly at all three sites instead of calling toString() — for example DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX"), or ISO_OFFSET_DATE_TIME applied to a value normalised to at least second precision, so the seconds are always present.
Workaround, and where there isn't one
For filters on a property, pass the RFC3339 String rather than an OffsetDateTime: Filter.property(p).gt("2024-03-01T00:00:00Z") takes the String overload and works (shown above).
There is no workaround on the metadata path — Filter.createdAt() and Filter.lastUpdatedAt() return DateProperty, whose comparison methods accept OffsetDateTime only. Same for writes, where the property map value has to be an OffsetDateTime to be recognised as a date at all.
Version
- java-client 6.3.1
- Weaviate 1.39.0
- 主要语言
- Java
- 星标
- 34
- 派生
- 30
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
weaviate/java-client 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 90/100
weaviate/java-client#621 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
weaviate/java-client#619 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
weaviate/java-client#615 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
weaviate/java-client#607 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
weaviate/java-client#603 ·
查看 weaviate/java-client 的全部 Issue
相似的 Issue
-
area/plugin
难度 2/5 1-3 小时 新手友好度 75/100
kestra-io/plugin-kestra#190 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
apache/rocketmq-dashboard#5064 ·