Repository navigation
Conversation
This was referenced Oct 14, 2026
ColinLeeo
requested review from
JackieTien97 and
shuwenwei
and
a lite review from Copilot
October 14, 2026 10:45
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues remain, and validation passed.
0 open findings
What changed in this PR
Fixes nullable three-valued AND evaluation in tree-model CASE expressions by caching the computed result.
Changes:
- Corrects
LogicAndColumnTransformercaching. - Adds nullable
ANDunit coverage. - Adds a
CASEintegration regression test.
| File | Description |
|---|---|
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/transformation/dag/column/binary/LogicBinaryColumnTransformerTest.java |
Tests nullable AND combinations and selection masks. |
iotdb-core/calc-commons/src/main/java/org/apache/iotdb/calc/transformation/dag/column/binary/LogicAndColumnTransformer.java |
Caches the computed AND result. |
integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java |
Adds SQL-level regression coverage. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
shuwenwei
approved these changes
Oct 14, 2026
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.
Tree-model CASE can take the wrong branch when a later WHEN contains nullable AND. For example, when
s1is NULL ands2is 1,CASE WHEN s1 > 100 THEN 1 WHEN s1 > 0 AND s2 > 0 THEN 2 ELSE 3 ENDreturns 2 instead of 3.LogicAndColumnTransformer.evaluateWithSelection()builds the correct three-valued AND result but caches the right operand. Cache the built result instead. This is a one-line production change and requires no cache-lifecycle or selection API changes.Regression coverage includes all nine NULL/false/true operand combinations with full and partial selection masks, plus the CASE SQL example with NULL, true, false, and earlier-branch rows.
Closes #18864.
Validation:
verifyfrom master8effe5d6ce, selecting onlyLogicBinaryColumnTransformerTest(5 tests) andIoTDBCaseWhenThenIT#testNullableAndInLaterCaseBranch(1 test, rebuilt 1C1D nodes): passed.