[SkipRecovery][FEA] Support count on ANSI interval columns [databricks] - #15938
[SkipRecovery][FEA] Support count on ANSI interval columns [databricks]#15938wjxiz1992 wants to merge 3 commits into
Conversation
Allow top-level ANSI interval inputs through HashAggregateExec type checks and recover the two strict count xfails with post-execution GPU plan validation. Keep interval grouping expressions on CPU because Spark implements distinct aggregation through grouping and interval hash partitioning is not supported. Performance: the change is limited to driver-side planning. It adds a linear scan of grouping expressions and no executor row loop or GPU kernel work for existing types; supported interval counts avoid CPU aggregate fallback and transition overhead. Signed-off-by: Allen Xu <allxu@nvidia.com>
There was a problem hiding this comment.
🟢 Approval recommended
The changes are narrowly scoped to HashAggregate planning/tagging, include explicit CPU fallback for unsupported interval grouping, and are backed by targeted Scala/Python validation plus regenerated support documentation.
Pull request overview
Enables GPU execution for count(interval_column) (both ANSI DayTime and YearMonth interval families) by extending HashAggregateExec type support while explicitly keeping ANSI-interval grouping on CPU (to preserve correctness given unsupported interval hash partitioning). Updates integration tests and generated support matrices/docs to reflect the new “partial support” boundary.
Changes:
- Extend
HashAggregateExecinput type signature to admit ANSI interval inputs, with support notes clarifying grouping limitations. - Add
GpuHashAggregateMetatagging to force CPU fallback when ANSI interval types appear in grouping expressions (e.g.,count(DISTINCT interval)plans). - Add/adjust Python IT coverage for both the newly supported GPU count path and the intentional distinct-count fallback path; regenerate support docs/matrices.
File summaries
| File | Description |
|---|---|
| sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuExecOverrides.scala | Allows ANSI intervals as HashAggregate inputs and annotates them as PS due to grouping limitations. |
| sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuAggregateExec.scala | Tags HashAggregate plans to fall back to CPU when grouping by ANSI interval types. |
| integration_tests/src/main/python/hash_aggregate_test.py | Converts former xfails into strict validations for interval count, and adds distinct-count fallback tests. |
| docs/supported_ops.md | Updates the support table to mark ANSI intervals as partially supported for HashAggregate with grouping disallowed. |
| tools/generated_files/supportedExecs.csv | Regenerates the canonical exec support matrix to reflect PS for ANSI intervals on HashAggregate. |
| tools/generated_files/420/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/413/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/412/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/411/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/404/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/403/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/402/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/401/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/400/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/359/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/358/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/357/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/356/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/355/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/354/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/353/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/352/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/351/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/350/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/344/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/343/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/342/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/341/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/340/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/334/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/333/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/332/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/331/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
| tools/generated_files/330/supportedExecs.csv | Regenerated versioned exec support matrix reflecting PS for ANSI intervals on HashAggregate. |
Review details
- Files reviewed: 34/34 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
build |
1 similar comment
|
build |
Signed-off-by: Allen Xu <allxu@nvidia.com>
|
build |
Signed-off-by: Allen Xu <allxu@nvidia.com>
|
build |
JaCoCo production line coverage: +9 lines (
sql-plugin +9; fix-line coverage, Spark 3.3, vs3859bcfca)Fixes #15776.
Description
This is a GPU coverage and performance improvement, not a result-correctness fix.
count(interval_column)already matched Spark CPU results, but the partial hash aggregate fell back to CPU because ANSI interval inputs were rejected at the operator boundary. This PR allows top-level day-time and year-month interval inputs for ordinarycount, removing that fallback and its CPU/GPU transition.count(DISTINCT interval)intentionally remains on CPU because Spark implements it by grouping on the interval value, and interval grouping and hash partitioning are not supported on the GPU.What changed
GpuHashAggregateExecfor ordinary interval counts.AI assistance: The change and PR description were prepared with Codex assistance.
Validation
4 passed, 32409 deselected. Executed plans containedGpuHashAggregateExecfor ordinary counts and the expected CPU aggregate for distinct counts.HashAggregatesSuite:Tests: succeeded 320, failed 0, canceled 0, ignored 0, pending 0; all 18 reactor modules succeeded;BUILD SUCCESS.hash_aggregate_test.pyon the same affected production and test logic, before only comment/support-matrix generation and a non-overlapping rebase:2154 passed, 78 skipped.sql-pluginproduction lines.Performance benchmark
Measured on PR head
6eb6d1e9dwith Spark 3.3.0 inlocal[8]mode on an NVIDIA RTX 5880 Ada Generation (48 GB), with one fixed concurrent GPU task and the RAPIDS memory pool capped at 30%. Each case read 1 million, 50 million, or 500 million ANSI interval values (10% nulls) from the same uncompressed Parquet input across 12 partitions and executedcount(a); data generation was excluded from the timings. The PR path was compared with the same exact-head JAR usingspark.rapids.sql.exec.HashAggregateExec=false, which reproduces the pre-PR operator boundary: the sameGpuFileGpuScanis followed byGpuColumnarToRowand CPU partial/finalHashAggregateExecinstead of GPU partial/final aggregation.Each mode received two warm-up runs followed by seven timed
collect()runs in alternating A/B order. Values below are warm-cache wall-clock medians, with min-max ranges in parentheses; every run asserted a non-null count equal to 90% of the input rows.The result is scale-dependent: fixed GPU scheduling and exchange overhead dominates at 1 million rows, while removing the row conversion and CPU aggregate yields a 1.60-2.96x speedup at 50-500 million rows. This benchmark therefore supports the large analytic-workload benefit without claiming a small-query latency improvement.
Additional validation and performance detail
sql-pluginbuilds: all 8 reactor modules succeeded in each build;BUILD SUCCESS.BUILD SUCCESS; the runtime JAR reported revision6eb6d1e9d.BUILD SUCCESS.git diff --check, Python bytecode compilation, shim coverage, and an exact-head four-reviewer local code review completed with 0 must-fix and 0 should-fix findings.Checklists
Documentation
Testing
(Please provide the names of the existing tests in the PR description.)
Performance