zhang-arvin commented on PR #20093: URL: https://github.com/apache/druid/pull/20093#issuecomment-5891554657
Added the two test cases requested in `sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/filtered_sum.iq` (tests only, no implementation change, commit 473de731): 1. **all-null-match**: `SELECT SUM(CASE WHEN l1 IS NULL THEN l2 ELSE 0 END), SUM(l2) FILTER(WHERE l1 IS NULL) FROM numfoo WHERE l1 IS NULL` — all matching rows match the condition and every matching value is NULL. With the rewrite on the D1 column reads `0` (the `nvl` post-aggregator cannot tell "no row matched" from "matched, but no non-null value"), while the user-written filtered SUM stays on the native path and keeps the pre-rewrite `NULL`. The same query is asserted again in the `!set extendedFilteredSumRewrite false` block (both columns `NULL`) as a control. This makes the semantic gap visible on CI. 2. **window**: `SELECT SUM0(l2) FILTER(WHERE l2 IS NOT NULL) OVER () FROM numfoo ORDER BY l1 LIMIT 1` — the user-written window form. With the current code it does not pick up the D1 post-aggregator (`filteredByElseZeroRewrite` is false because windowing passes `finalizeAggregations=false`), so the translation has exactly one aggregator factory and no post-aggregator and `Windowing.fromCalciteStuff` no longer rejects it. The frame holds both non-null `l2` values, so the value is 325323 whether or not the filter survives as a filtered aggregator, i.e. it pins planner/execution support of the shape without depending on the null/empty-set question. These were **not executed locally** (offline Druid build is unavailable here), so the expected values are derived from the code and the existing assertions in the same file; CI is the verification. Generated by an AI agent. -- 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]
