Filter all-null FIELD columns before tablet insert in Java/C++/Python… - #18533
Open
hongzhi-gao wants to merge 5 commits into
Open
Filter all-null FIELD columns before tablet insert in Java/C++/Python…#18533hongzhi-gao wants to merge 5 commits into
hongzhi-gao wants to merge 5 commits into
Conversation
… clients Skip or shrink tablets that only contain null FIELD values so insert paths avoid shipping unused measurement columns across languages.
jt2594838
reviewed
Aug 27, 2026
Comment on lines
+416
to
+429
| static bool isColumnAllNull(const BitMap& bitMap, size_t rowSize) { | ||
| if (rowSize == 0) { | ||
| return false; | ||
| } | ||
| if (bitMap.getSize() == rowSize && bitMap.isAllMarked()) { | ||
| return true; | ||
| } | ||
| for (size_t row = 0; row < rowSize; row++) { | ||
| if (!bitMap.isMarked(row)) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| } |
Contributor
There was a problem hiding this comment.
Why is bitMap.isAllMarked not enough?
Contributor
Author
There was a problem hiding this comment.
BitMap is sized to maxRowNumber, not rowSize. When rowSize < maxRowNumber, tail bits are unmarked, so isAllMarked() returns false even if all active rows are null. We only use it when getSize() == rowSize.
Contributor
There was a problem hiding this comment.
Is it possible to add BitMap.isAllMarked(int start, int end) to accelerate this iteration?
Comment on lines
+479
to
+481
| auto filteredOut = std::make_shared<Tablet>(tablet.deviceId, keptSchemas, keptColumnTypes, | ||
| tablet.maxRowNumber, tablet.isAligned); | ||
| filteredOut->deleteColumns(); |
Contributor
There was a problem hiding this comment.
Not create-and-delete or copy. May add a constructor for this.
Table-model tablet inserts may carry only time and tag/attribute columns. Do not treat all-null FIELD columns as an empty tablet when non-FIELD columns remain, and clarify buildInsertTabletReq skip semantics.
…olumns. Add a private constructor and createWithoutValueColumns to build tablets without pre-allocating value columns, fix bitmap null-check bounds, and update the Java table-model test constructor.
BitMap is sized to maxRowNumber, so a full-map isAllMarked() can miss all-null FIELD columns when rowSize is smaller. Use isRangeAllMarked on [0, rowSize) in the Java, C++, and Python clients.
A never-written column is treated as all-null; dropping it skipped the existing measurement-name check and omitted timeseries that tests expect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Before inserting a Tablet, drop FIELD columns that are entirely null within
[0, rowSize). TAG / ATTRIBUTE columns are always kept. This avoids shipping unused measurement columns when the client schema is wide but each batch only fills a subset of fields.Behavior
Multi-language clients
Aligned the same logic in Java / C++ / Python Session insert tablet paths (
insertTablet/insertTablets/ aligned / relational where applicable). C API goes through the C++ Session, so no separate implementation.Design notes
SessionUtils.filterNullColumns(Java / C++) andfilter_null_columns(Python), and is invoked when building insert requests after sort.std::shared_ptr<const Tablet>(non-owning empty deleter for the original tablet; owning shared_ptr for a filtered copy) instead of a raw pointer + out-parameter.This PR has:
Key changed/added classes (or packages if there are too many classes) in this PR
org.apache.iotdb.session.util.SessionUtilsorg.apache.iotdb.session.Sessioniotdb-client/client-cppSessionUtils::filterNullColumns/Sessioniotdb.utils.SessionUtils(Python)SessionUtilsTest(Java),sessionUtilsTest(C++),test_session_utils.py(Python)