[Bug] Python NumpyTablet silently drops trailing zero bytes from BLOB values
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 85/100
調査の方向性
Python クライアントの NumpyTablet と TSDataType.BLOB.np_dtype() の実装を読み、Tablet.get_binary_values() と併せて BLOB のシリアライズ経路を確認してください。提示された例で問題を再現し、エンコードされたペイロードを比較してください。NumPy ベースの BLOB 値が末尾のゼロバイトを保持し、ペイロードが Tablet と一致し、バイト型以外のスカラーの型変換が引き続きテストでカバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 6.4k
- フォーク
- 1.2k
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 284
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/iotdb のほかの issue
-
[Bug] sbin/replace-conf-from-env.sh word-splits the whole environment and corrupts iotdb-system.properties対応中かも @anishmehta24 が 69 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/iotdb#18655 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
IoTDB Edge: stop-edge.sh does not stop its own process when IOTDB_HOME is set, and reports success対応中かも @PDGGK が 88 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[Bug] findColumn throws NullPointerException instead of SQLException for an unknown column name対応中かも @PDGGK が 130 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[Bug] ResultSetMetaData.getCatalogName throws IndexOutOfBoundsException instead of SQLException for out-of-range columns対応中かも @PDGGK が 132 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openhab/openhab-addons#22512 ·
メンテナーはふだん 1 日以内に返信
-
help wanted maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
apache/maven-project-info-reports-plugin#704 ·
メンテナーはふだん 1 日以内に返信
-
help wanted maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/maven-ejb-plugin#261 ·
メンテナーはふだん 1 日以内に返信
-
help wanted maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/maven-archetype#1086 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信