Skip to content

session python object#17338

Open
hongzhi-gao wants to merge 2 commits intoapache:masterfrom
hongzhi-gao:feature/session-python-object
Open

session python object#17338
hongzhi-gao wants to merge 2 commits intoapache:masterfrom
hongzhi-gao:feature/session-python-object

Conversation

@hongzhi-gao
Copy link
Contributor

Description

This PR adds OBJECT type support to the Python session client for both write and read paths, and adds test coverage for object-type serialization and round-trip query behavior.

Content1: Add OBJECT type definition and write-path support

  • Added TSDataType.OBJECT = 12 in Python constants to align with server-side enum semantics.
  • Extended write serialization in:
    • Session.value_to_bytes() (iotdb-client/client-py/iotdb/Session.py)
    • Tablet.get_binary_values() (iotdb-client/client-py/iotdb/utils/Tablet.py)
    • NumpyTablet.get_binary_values() (iotdb-client/client-py/iotdb/utils/NumpyTablet.py)
  • Design choice: treat OBJECT as binary payload (length-prefixed bytes), consistent with existing TEXT/STRING/BLOB binary transport pattern and Java-side session behavior.

Content2: Add OBJECT type read-path support

  • Extended TsBlock decoding to accept and parse OBJECT columns:
    • read_column_types() and read_binary_column() in iotdb-client/client-py/iotdb/tsfile/utils/tsblock_serde.py
  • Extended dataset conversion and field access:
    • iotdb-client/client-py/iotdb/utils/iotdb_rpc_dataset.py
    • iotdb-client/client-py/iotdb/utils/Field.py
    • iotdb-client/client-py/iotdb/utils/SessionDataSet.py
  • Design choice: return OBJECT as raw bytes in Python APIs (same practical behavior as BLOB-style handling) for deterministic round-trip verification.

Content3: Tests for OBJECT type

  • Added integration test:
    • iotdb-client/client-py/tests/integration/test_object_type.py
    • Covers write and read round-trip for OBJECT values using Tablet, NumpyTablet, and record APIs.
  • Extended unit test:
    • iotdb-client/client-py/tests/unit/test_numpy_tablet.py
    • Verifies OBJECT serialization parity between Tablet and NumpyTablet.

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR
  • iotdb-client/client-py/iotdb/utils/IoTDBConstants.py
  • iotdb-client/client-py/iotdb/Session.py
  • iotdb-client/client-py/iotdb/utils/Tablet.py
  • iotdb-client/client-py/iotdb/utils/NumpyTablet.py
  • iotdb-client/client-py/iotdb/tsfile/utils/tsblock_serde.py
  • iotdb-client/client-py/iotdb/utils/iotdb_rpc_dataset.py
  • iotdb-client/client-py/iotdb/utils/Field.py
  • iotdb-client/client-py/iotdb/utils/SessionDataSet.py
  • iotdb-client/client-py/tests/integration/test_object_type.py
  • iotdb-client/client-py/tests/unit/test_numpy_tablet.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant