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

Đang mở
#2,263 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@steven-asearcy đang làm issue này rồi.

Từ ngày 18/11/2026.

  • #2264 của @steven-asearcy — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend-api-design

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
230
Fork
173
Merge trung bình
4 ngày 16 giờ
Pull request đã merge (30 ngày)
23

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của weaviate/weaviate-python-client

Tất cả issue của weaviate/weaviate-python-client

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.