codewithsruthi opened a new pull request, #20407:
URL: https://github.com/apache/pinot/pull/20407

   Fixes #20294
   
   ### Summary
   While `PinotOperatorTable.ARRAY_TO_MV` already propagates nullable component 
types in the planner, leaf-stage execution still crashed on 
`COALESCE(ARRAY_TO_MV(...), ...)` and ignored SQL `NULL` bitmaps in 
`ExpressionScanDocIdIterator` for multi-value expressions.
   
   ### Changes
   - **`CoalesceTransformFunction` (`pinot-core`):**
     - Added multi-value detection (`_isSingleValue`, `_argIsSingleValue`, 
`_argIsLiteral`) and `*_MV_NO_DICTIONARY_METADATA` / `UNKNOWN_MV_METADATA` 
support across `INT`, `LONG`, `FLOAT`, `DOUBLE`, `BIG_DECIMAL`, `STRING`, and 
`UNKNOWN`.
     - Implemented `transformTo*ValuesMV(ValueBlock)` with cross-type 
delegation to `super` (supporting `CAST(COALESCE(...) AS ...)`), cached 
1-element arrays for `LiteralTransformFunction` fallbacks, non-null MV 
pass-through fast path, and preservation of non-null empty arrays `[]` (only 
SQL `NULL` triggers fallback).
     - Fixed cached `RoaringBitmap` in-place mutation in 
`getNullBitmap(ValueBlock)` and short-circuited `getNullBitMaps(...)` once a 
guaranteed non-null operand is encountered.
   - **`ExpressionScanDocIdIterator` (`pinot-core`):**
     - Handled `PredicateEvaluationResult.NULL` in the MV branch (resolving 
`TODO(issues/10882)`).
     - Respected `_transformFunction.getNullBitmap(projectionBlock)` when 
`_nullHandlingEnabled` is true across dictionary-encoded and non-dictionary MV 
branches (`INT`, `LONG`, `FLOAT`, `DOUBLE`, `STRING`, `BYTES`, `BIG_DECIMAL`) 
using a linear `IntIterator`, preserving `ScalarTransformFunctionWrapper` 
evaluation order.
   - **`ExpressionFilterOperator` (`pinot-core`):**
     - Guarded `toExplainString()` and `explainAttributes()` when 
`_predicateEvaluator == null` (`IS_NULL` / `IS_NOT_NULL`) to prevent NPEs 
during `EXPLAIN`.
   - **Tests (`pinot-core`, `pinot-query-planner`, `pinot-query-runtime`):**
     - Flipped the 4 previously-failing leaf `COALESCE(ARRAY_TO_MV(...), ...)` 
queries in `MvAggregate.json` from `expectedException` to exact result 
assertions and added 8 new MV null / `COALESCE` / empty-array `filterMv` 
queries.
     - Added unit tests in `CoalesceTransformFunctionTest` and 
`ExpressionScanDocIdIteratorTest` (including `ExpressionFilterOperator` explain 
coverage) and updated the stale comment in `MvAggregatePlanTest`.
   
   ### Verification
   - `CoalesceTransformFunctionTest`: 14/14 passed
   - `ExpressionScanDocIdIteratorTest`: 5/5 passed
   - `NullHandlingEnabledQueriesTest`: 161/161 passed
   - `MvAggregatePlanTest` (14/14), `ArrayToMvValidationVisitorTest` (9/9) 
passed
   - `ResourceBasedQueriesTest` (`MvAggregate.json`): 60/60 queries passed
   - Pre-commit checks (`spotless:apply`, `license:check`, `checkstyle:check`, 
compiler warnings on added lines): clean across `pinot-core`, 
`pinot-query-planner`, `pinot-query-runtime`.
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [PR] Support multi-value COALES... codewithsruthi (via GitHub) via commits

Reply via email to