ColinLeeo opened a new issue, #18864:
URL: https://github.com/apache/iotdb/issues/18864

   ### Description
   
   Tree-model `LogicAndColumnTransformer.evaluateWithSelection()` builds the 
three-valued AND result but caches `rightColumn` instead of `builder.build()`. 
A CASE that uses this selected condition can take a branch whose AND condition 
should be NULL.
   
   ### Reproduction
   
   With one row where `s1` is NULL and `s2` is 1:
   
   ```sql
   SELECT CASE
     WHEN s1 > 100 THEN 1
     WHEN s1 > 0 AND s2 > 0 THEN 2
     ELSE 3
   END FROM root.p;
   ```
   
   Expected: 3. Actual: 2. The first WHEN is NULL, and the second WHEN is `NULL 
AND true`, also NULL, so neither should match.
   
   A direct transformer reproduction on `d7239384fd` using 
`TreeCaseWhenThenColumnTransformer`, the real comparison transformers, and 
`LogicAndColumnTransformer` confirms `expected=3.0, actual=2.0`. The faulty 
LogicAnd file is unchanged between merge base `fbd5fd22a6` and PR #18826, and 
the [review](https://github.com/apache/iotdb/pull/18826) independently 
reproduced this on base.
   
   ### Suggested correction and coverage
   
   Cache the constructed AND result rather than the right operand. Add 
selection-mode three-valued logic tests including NULL/true, NULL/false, and 
masked-out rows, plus a CASE SQL regression. Track separately from #18826's 
block-boundary cache invalidation work.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to