[Bug] Python NumpyTablet silently drops trailing zero bytes from BLOB values
Maintainer thường phản hồi trong vòng 1 ngày
Đá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
- 85/100
Hướng nghiên cứu
Đọc các phần triển khai NumpyTablet và TSDataType.BLOB.np_dtype() của ứng dụng khách Python, sau đó kiểm tra đường tuần tự hóa BLOB cùng với Tablet.get_binary_values(). Tái hiện vấn đề bằng ví dụ được cung cấp và so sánh các payload đã mã hóa. Công việc hoàn tất khi các giá trị BLOB dựa trên NumPy giữ nguyên các byte 0 ở cuối, payload khớp với Tablet, và việc ép kiểu các giá trị vô hướng không phải byte vẫn được kiểm thử.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Search before asking
- I searched the existing issues for NumpyTablet and BLOB truncation.
Version
Python client from master at 24d22d21ade21e2c9c2e2f04a742e93d7e51df54, Python 3.13.14, NumPy 2.5.5, macOS 15.3.2 arm64.
Minimal reproduction
Run this with the Python client on the import path. It inspects the value bytes used by the insert request and runs without a database.
import numpy as np
from iotdb.utils.IoTDBConstants import TSDataType
from iotdb.utils.NumpyTablet import NumpyTablet
from iotdb.utils.Tablet import Tablet
blob = bytes.fromhex("41 00 00")
columns = ["payload"]
types = [TSDataType.BLOB]
numpy_tablet = NumpyTablet(
"root.test.d", columns, types, [np.array([blob], dtype=object)], np.array([1])
)
tablet = Tablet("root.test.d", columns, types, [[blob]], [1])
print(numpy_tablet.get_binary_values().hex(" "))
print(tablet.get_binary_values().hex(" "))
Expected result
Both calls should print 00 00 00 03 41 00 00. The first four bytes encode the length, followed by the three original BLOB bytes.
Actual result
NumpyTablet prints 00 00 00 01 41. The regular Tablet prints 00 00 00 03 41 00 00. The NumPy path silently changes the length and contents before the request reaches the server.
Cause and proposed fix
TSDataType.BLOB.np_dtype() returns bytes, so the tablet converts the object column into NumPy's fixed-width byte-string representation. Accessing an element then strips trailing NUL bytes before serialization computes its length.
Use an object dtype for BLOB columns so that each Python bytes value retains its own length until serialization. Callers can use dtype=TSDataType.BLOB.np_dtype() when creating the array. Preserve the existing coercion of non-byte scalars and test the encoded payload against Tablet. An existing fixed-width S array has already lost the distinction between trailing zeros and padding.
Are you willing to submit a PR?
- Yes.
- Ngôn ngữ chính
- Java
- Star
- 6.4k
- Fork
- 1.2k
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 284
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/iotdb
-
[Bug] sbin/replace-conf-from-env.sh word-splits the whole environment and corrupts iotdb-system.propertiesCó thể đã có người làm @anishmehta24 đã nhận 69 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/iotdb#18655 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
IoTDB Edge: stop-edge.sh does not stop its own process when IOTDB_HOME is set, and reports successCó thể đã có người làm @PDGGK đã nhận 88 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] 执行start-all.sh后无法启动集群问题Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] findColumn throws NullPointerException instead of SQLException for an unknown column nameCó thể đã có người làm @PDGGK đã nhận 130 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] ResultSetMetaData.getCatalogName throws IndexOutOfBoundsException instead of SQLException for out-of-range columnsCó thể đã có người làm @PDGGK đã nhận 132 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
openhab/openhab-addons#22512 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
help wanted maintenance
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
apache/maven-project-info-reports-plugin#704 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
help wanted maintenance
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/maven-ejb-plugin#261 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
help wanted maintenance
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/maven-archetype#1086 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày