Skip to content

[Python] Keep NumpyTablet null bitmaps aligned when sorting timestamps - #19403

Merged
HTHou merged 2 commits into
apache:masterfrom
DaZuiZui:codex/numpy-tablet-sort-null-bitmaps
Nov 27, 2026
Merged

HTHou merged 2 commits into
apache:masterfrom
DaZuiZui:codex/numpy-tablet-sort-null-bitmaps

Conversation

@DaZuiZui

Copy link
Copy Markdown
Contributor

Fixes #19402

Description

NumpyTablet sorts out-of-order timestamps and values on construction. This change applies the same row order to each supplied null bitmap. A column without a bitmap keeps its existing encoding.

For example, consider an INT32 column with rows (20, NULL) and (10, 123), using zero as the placeholder. The old payload marked time 10 as null and exposed zero at time 20. The corrected payload encodes (10, 123) and (20, NULL).

Tests

  • Added a regression test that compares serialized timestamps and values with a row-oriented Tablet. It covers two columns with different null positions, a column without a bitmap, and a null moving from bit 0 to bit 8.
  • Confirmed that the new test failed on the original code at the bitmap byte. All 55 Python client unit tests passed with the fix (pytest -q tests/unit from iotdb-client/client-py).
  • Checked the two-row example through Session.gen_insert_tablet_req(). The resulting null bitmap byte is 0x02.

@JackieTien97
JackieTien97 requested a review from HTHou November 27, 2026 01:12

@HTHou HTHou left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified that the new regression test fails on the base commit and that all 55 Python client unit tests pass on this revision.

@HTHou HTHou left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bitmap sort is now vectorized and value columns are replaced one at a time. I rechecked both changes on this revision and all 56 Python client unit tests passed locally.

@DaZuiZui

Copy link
Copy Markdown
Contributor Author

thank~

@HTHou
HTHou merged commit b0ce164 into apache:master Nov 27, 2026
46 of 48 checks passed
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.

[Bug] Python NumpyTablet associates nulls with the wrong rows when sorting timestamps

2 participants