batch insert fails the whole batch with "ValueError: Unexpected type" when a value is a Decimal
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
Start with _serialize_primitive in collections/batch/grpc_batch.py and compare its handling of unsupported values with the data.insert error described in the issue. Check the existing batch serialization tests and add coverage for decimal.Decimal and numpy.float32; done means these values produce a clear WeaviateInvalidInputError. Pull request #2264 is already open for this issue.
由索引模型根据 Issue 内容生成。
描述
ran into this in a singer target. the singer sdk parses json numbers as decimal.Decimal, and postgres numeric columns come back as Decimal through psycopg too, so probably not just me.
data.insert gives a clear error:
WeaviateInvalidInputError: Invalid input provided: Cannot serialize value of type <class 'decimal.Decimal'> to Weaviate..
the grpc paths don't. insert_many raises ValueError: Unexpected type from inside protobuf, and the batch context managers just log it. every object in that batch ends up in failed_objects, including the good ones:
with col.batch.fixed_size(batch_size=100) as batch:
for i in range(99):
batch.add_object({"price": float(i)})
batch.add_object({"price": Decimal("9.99")})
len(col.batch.failed_objects) # 100
len(col) # 0
the message doesn't say which property or type it was, so it's hard to track down.
cause is _serialize_primitive in collections/batch/grpc_batch.py. it passes anything it doesn't handle straight to Struct.update. numpy.float32 hits the same thing.
weaviate-client 4.24.1, weaviate 1.40.5, python 3.13
i'll put up a PR that raises the same WeaviateInvalidInputError as data.insert. one bad value would still fail the whole batch after that, which felt like a bigger change so i left it alone. can take a look at that too if you want.
- 主要语言
- Python
- 星标
- 230
- 派生
- 173
- 平均合并
- 4 天 16 小时
- 30 天内合并 PR
- 23
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
weaviate/weaviate-python-client 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
weaviate/weaviate-python-client#2265 ·
维护者通常 1 天内回复
-
Batch: re-added rate-limited objects stay in results.objs.all_responses as errors可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
weaviate/weaviate-python-client#2179 ·
维护者通常 1 天内回复
-
collections/batch: one object that fails client-side encoding fails every object sent with it可能已有人在做 @shadowmodder 今天认领。 未关闭bug
难度 3/5 1-2 天 新手友好度 72/100
weaviate/weaviate-python-client#2266 ·
维护者通常 1 天内回复
-
collections/batch/sync.py: after a fast hang-up reconnect the old stream's sender steals a request, hanging add_object可能已有人在做 @shadowmodder 于 2 天前认领。 未关闭bug
难度 4/5 3-5 天 新手友好度 45/100
weaviate/weaviate-python-client#2261 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
weaviate/weaviate-python-client#2259 ·
维护者通常 1 天内回复
查看 weaviate/weaviate-python-client 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
-
breaking change
难度 1/5 1 小时以内 新手友好度 84/100
it-at-m/lhm_actions#441 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
TigreGotico/euskaphone#68 ·
维护者通常 1 天内回复
-
[BUG] arc_agi_2: a correct grid in the format the prompt asks for scores 0 (exact_match gold is a one-line list)可能已有人在做 @BahaaMattar 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
huggingface/lighteval#1510 ·
维护者通常 1 天内回复