batch insert fails the whole batch with "ValueError: Unexpected type" when a value is a Decimal

オープン
#2,263 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@steven-asearcy がすでに取り組んでいます。

2026年11月18日 から。

  • #2264 @steven-asearcy による — オープン

評価

難易度
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時間
マージ済み PR(30日)
23

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

weaviate/weaviate-python-client のほかの issue

weaviate/weaviate-python-client の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。