[Bug] Python NumpyTablet silently drops trailing zero bytes from BLOB values
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 85/100
Línea de trabajo
Lee las implementaciones de NumpyTablet y TSDataType.BLOB.np_dtype() del cliente de Python y, después, revisa la ruta de serialización de BLOB junto con Tablet.get_binary_values(). Reproduce el problema con el ejemplo proporcionado y compara las cargas útiles codificadas. Se considera terminado cuando los valores BLOB respaldados por NumPy conservan los bytes cero finales, la carga útil coincide con Tablet y la coerción de escalares que no son bytes sigue cubierta por una prueba.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Java
- Estrellas
- 6.4k
- Forks
- 1.2k
- Merge medio
- 1 d 12 h
- PR fusionados (30 d)
- 284
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/iotdb
-
[Bug] sbin/replace-conf-from-env.sh word-splits the whole environment and corrupts iotdb-system.propertiesPosiblemente ocupada @anishmehta24 la tomó hace 69 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/iotdb#18655 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
IoTDB Edge: stop-edge.sh does not stop its own process when IOTDB_HOME is set, and reports successPosiblemente ocupada @PDGGK la tomó hace 88 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[Bug] 执行start-all.sh后无法启动集群问题Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[Bug] findColumn throws NullPointerException instead of SQLException for an unknown column namePosiblemente ocupada @PDGGK la tomó hace 130 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[Bug] ResultSetMetaData.getCatalogName throws IndexOutOfBoundsException instead of SQLException for out-of-range columnsPosiblemente ocupada @PDGGK la tomó hace 132 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
Todos los issues de apache/iotdb
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
openhab/openhab-addons#22512 ·
Los mantenedores suelen responder en 1 día
-
help wanted maintenance
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
apache/maven-project-info-reports-plugin#704 ·
Los mantenedores suelen responder en 1 día
-
help wanted maintenance
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/maven-ejb-plugin#261 ·
Los mantenedores suelen responder en 1 día
-
help wanted maintenance
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/maven-archetype#1086 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día