Skip to content

Support table-model OBJECT writes and OBJECT result decoding - #12

Open
CritasWang wants to merge 1 commit into
mainfrom
feat/tablet-object-write
Open

Support table-model OBJECT writes and OBJECT result decoding#12
CritasWang wants to merge 1 commit into
mainfrom
feat/tablet-object-write

Conversation

@CritasWang

Copy link
Copy Markdown
Contributor

Summary

Add table-model OBJECT write support and the read-side display semantics to the Rust
client, mirroring the already-merged SDK implementations:

No Thrift IDL / generated src/protocol/ changes.

What changed

  • TSDataType::Object = 12 (official TSFile code) + from_code.
  • Value::Object(Vec<u8>) carrying the already-framed OBJECT segment
    [1 byte isEOF][8 byte big-endian offset][content], plus
    object_bytes_to_string producing (Object) 1023 B / (Object) 1.00 KB /
    (Object) 1.00 MB / (Object) 1.00 GB (same thresholds as Go/Node/C#).
  • Tablet::build_object_value(is_eof, offset, content) and
    Tablet::set_object_value_at(...) (Go SetObjectValueAt counterpart) with
    column-type / row / column / negative-offset validation. Overwriting a null cell sets
    the Option back to Some, which clears the null bit Rust derives at serialization
    time (Go's unmarkNullValueAt).
  • serialize_values/record serialization write OBJECT columns with the same
    4-byte BE length-prefixed binary layout as BLOB; insertTablet now sends type code 12.
  • TsBlock BinaryArray decoding accepts OBJECT and keeps the raw 8-byte BE size +
    internal path; SessionDataSet::apply_logical_type formats select file OBJECT
    metadata into Value::String("(Object) 1.00 KB") while select READ_OBJECT(file)
    still returns raw Value::Blob.
  • Documentation in README/README_ZH and an OBJECT demo in examples/table_session.rs
    (probes server support and skips on IoTDB < 2.0.8, keeping CI green on 2.0.6).

Tests

Golden-byte / mock tests (no server):

  • data_type_codes_match_spec / data_type_from_code_round_trips include 12.
  • value::object_bytes_to_string_* unit boundaries and short-input error.
  • tablet::build_object_value_frames_segments,
    set_object_value_at_writes_whole_and_segmented_rows,
    set_object_value_at_clears_previously_null_cell,
    set_object_value_at_rejects_invalid_inputs; all_types_known_bytes /
    all_types_null_placeholders now cover OBJECT with byte-exact expectations.
  • tsblock::binary_array_object_metadata_and_nulls and truncated-payload error.
  • dataset::object_column_renders_size_summary /
    short_object_metadata_is_decode_error; READ_OBJECT stays BLOB via the existing
    logical-type retagging tests.
  • session::insert_tablet_request_carries_object_type_12 builds the actual
    TSInsertTabletReq and checks types == [11, 12], values buffer, categories and
    writeToTable.
  • table_session::live_object_write_roundtrip: whole object, 512+512 segmented
    inserts, null row, count(*), READ_OBJECT byte round-trip and select file
    summary; probes OBJECT support and skips exactly like Go PR 175's e2e.

Local verification: cargo fmt, cargo clippy --all-targets -- -D warnings
(default and --features tls), ./tools/check-license.sh,
cargo test (126 passed) and cargo test --features tls (137 passed);
cargo build --example table_session compiles.

Mirrors apache/iotdb-client-go#175, apache/iotdb-client-nodejs#25 and
apache/iotdb-client-csharp#64.
- TSDataType::Object = 12 (official TSFile code) and from_code.
- Value::Object(Vec<u8>) carrying the already-framed OBJECT segment
(1 byte isEOF + 8 byte big-endian offset + content), plus
object_bytes_to_string for the "(Object) 1.00 KB" display format.
- Tablet::build_object_value / set_object_value_at with column/row/offset
validation; set_object_value_at overwrites null cells, which clears the
derived null bitmap bit. serialize_values writes OBJECT columns with the
same 4-byte length-prefixed binary layout as BLOB.
- TsBlock BinaryArray decoding accepts OBJECT; SessionDataSet formats
select file OBJECT metadata as Value::String summary while
select READ_OBJECT(file) keeps returning raw Value::Blob.
- Golden-byte unit tests for whole/segmented/null writes, bitmap clearing,
invalid arguments, TsBlock decode and dataset display semantics; a
live-server OBJECT round-trip that probes support and skips like Go's e2e.
- Document OBJECT in the READMEs and demo it in the table_session example.
No Thrift IDL or generated protocol changes.
Sign up for freeto 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

@CritasWang