yashmayya opened a new pull request, #19973: URL: https://github.com/apache/pinot/pull/19973
## Problem Since apache/pinot#19216, `PinotFilterJoinRule` keeps the whole `WHERE` filter above a join when any part of it is non-deterministic or volatile. `ARRAY_TO_MV` is flagged non-deterministic, so any query like this now fails: ```sql SELECT ... FROM a JOIN e ON a.col1 = e.col1 WHERE e.col2 = 'x' AND ARRAY_TO_MV(e.mcol1) = 'a' ``` ``` Function 'ArrayToMv' is not supported in FILTER Intermediate Stage ``` `ARRAY_TO_MV` is flagged non-deterministic only to stop Calcite from folding `ARRAY_TO_MV(c) = 'a' AND ARRAY_TO_MV(c) = 'b'` to `false`. Its value depends only on its row, so it is safe to move. ## Fix - `PinotRuleUtils.isRelocatable` ignores `ARRAY_TO_MV`'s own determinism and volatility flags. It still checks its operands, so `ARRAY_TO_MV(<volatile expr>)` stays in place. - The `ArrayToMv ... not supported in PROJECT` error now suggests `CROSS JOIN UNNEST(...)` as the alternative. ## Tests - `PinotRuleUtilsTest`: `ARRAY_TO_MV` is relocatable; with a `rand()` or `stageId()` operand it is not. - `JoinPlans.json`: both conjuncts of the query above go to the leaf stage. - `ValidationErrorPlan.json`: the PROJECT error mentions `CROSS JOIN UNNEST`. - `Joins.json` (runtime): `ARRAY_TO_MV` `=` / `IN` filters over a join, including two `=` on the same column (not folded to `false`). These fail without the fix. -- 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]
