Filter all-null FIELD columns before tablet insert in Java/C++/Python… - #18533
Open
hongzhi-gao wants to merge 1 commit into
Open
Filter all-null FIELD columns before tablet insert in Java/C++/Python…#18533hongzhi-gao wants to merge 1 commit into
hongzhi-gao wants to merge 1 commit 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
+148
to
+149
| // Returns false when all FIELD columns are null and the insert should be skipped. | ||
| static bool buildInsertTabletReq(TSInsertTabletReq& request, Tablet& tablet, bool sorted); |
Contributor
There was a problem hiding this comment.
For the table model, time-only insertion is allowed.
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?
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.
| return; | ||
| } | ||
| request.setWriteToTable(true); | ||
| request.setColumnCategories(toEnumOrdinalsAsBytes(tablet.getColumnTypes())); |
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)