Skip to content

Commit 4ae19eb

Browse files
authored
fix: update clickbench expected plan for NDV-aware optimization (#21050)
## Which issue does this PR close? Fixes CI breakage on `main` introduced by #19957. ## Rationale for this change #19957 introduced NDV extraction from Parquet metadata. The optimizer now sees NDV=1 for `HitColor`, `BrowserCountry`, `BrowserLanguage` in the clickbench test file and short-circuits `COUNT(DISTINCT)` to a constant projection, skipping the full table scan. ## What changes are included in this PR? Updates the expected EXPLAIN plan in `clickbench.slt` to match the new (better) physical plan: ```diff - 01)AggregateExec: mode=Single, gby=[], aggr=[count(DISTINCT hits.HitColor), ...] - 02)--DataSourceExec: file_groups={1 group: [...]}, projection=[HitColor, BrowserLanguage, BrowserCountry], file_type=parquet + 01)ProjectionExec: expr=[1 as count(DISTINCT hits.HitColor), 1 as count(DISTINCT hits.BrowserCountry), 1 as count(DISTINCT hits.BrowserLanguage)] + 02)--PlaceholderRowExec ``` ## Are these changes tested? This PR *is* the test fix. Verified locally with `cargo test --profile ci -p datafusion-sqllogictest --test sqllogictests`. ## Are there any user-facing changes? No.
1 parent 7014a45 commit 4ae19eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

datafusion/sqllogictest/test_files/clickbench.slt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,8 +1203,8 @@ logical_plan
12031203
02)--SubqueryAlias: hits
12041204
03)----TableScan: hits_raw projection=[HitColor, BrowserLanguage, BrowserCountry]
12051205
physical_plan
1206-
01)AggregateExec: mode=Single, gby=[], aggr=[count(DISTINCT hits.HitColor), count(DISTINCT hits.BrowserCountry), count(DISTINCT hits.BrowserLanguage)]
1207-
02)--DataSourceExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/data/clickbench_hits_10.parquet]]}, projection=[HitColor, BrowserLanguage, BrowserCountry], file_type=parquet
1206+
01)ProjectionExec: expr=[1 as count(DISTINCT hits.HitColor), 1 as count(DISTINCT hits.BrowserCountry), 1 as count(DISTINCT hits.BrowserLanguage)]
1207+
02)--PlaceholderRowExec
12081208

12091209
query III
12101210
SELECT COUNT(DISTINCT "HitColor"), COUNT(DISTINCT "BrowserCountry"), COUNT(DISTINCT "BrowserLanguage") FROM hits;

0 commit comments

Comments
 (0)