[Bug] Python NumpyTablet silently drops trailing zero bytes from BLOB values
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 85/100
Direção de pesquisa
Leia as implementações de NumpyTablet e TSDataType.BLOB.np_dtype() do cliente Python e, em seguida, verifique o caminho de serialização de BLOB junto com Tablet.get_binary_values(). Reproduza o problema com o exemplo fornecido e compare os payloads codificados. O trabalho está concluído quando os valores BLOB baseados em NumPy preservam os bytes zero finais, o payload corresponde ao de Tablet e a coerção de escalares que não são bytes continua coberta por um teste.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Java
- Estrelas
- 6.4k
- Forks
- 1.2k
- Merge médio
- 1d 12h
- PRs com merge (30d)
- 284
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de apache/iotdb
-
[Bug] sbin/replace-conf-from-env.sh word-splits the whole environment and corrupts iotdb-system.propertiesTalvez já em andamento @anishmehta24 assumiu há 69 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
apache/iotdb#18655 · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
IoTDB Edge: stop-edge.sh does not stop its own process when IOTDB_HOME is set, and reports successTalvez já em andamento @PDGGK assumiu há 88 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
[Bug] findColumn throws NullPointerException instead of SQLException for an unknown column nameTalvez já em andamento @PDGGK assumiu há 130 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
[Bug] ResultSetMetaData.getCatalogName throws IndexOutOfBoundsException instead of SQLException for out-of-range columnsTalvez já em andamento @PDGGK assumiu há 132 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
Todas as issues de apache/iotdb
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
openhab/openhab-addons#22512 ·
Mantenedores costumam responder em até 1 dia
-
help wanted maintenance
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
apache/maven-project-info-reports-plugin#704 ·
Mantenedores costumam responder em até 1 dia
-
help wanted maintenance
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/maven-ejb-plugin#261 ·
Mantenedores costumam responder em até 1 dia
-
help wanted maintenance
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/maven-archetype#1086 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
Mantenedores costumam responder em até 1 dia