test: add SQL file tests for regr_* linear-regression aggregates#4551
Merged
Conversation
mbutrovich
approved these changes
Jun 2, 2026
Contributor
mbutrovich
left a comment
There was a problem hiding this comment.
Tests are good! Thanks @andygrove!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
N/A. This adds test coverage only.
Rationale for this change
The SQL standard linear-regression aggregates (
regr_count,regr_avgx,regr_avgy,regr_sxx,regr_syy,regr_sxy,regr_slope,regr_intercept,regr_r2) had no Comet test coverage. Comet already accelerates several of them natively, because Spark lowers them toCount/Averageaggregates that Comet supports, but this was unverified. These tests establish which of the family run natively in Comet versus fall back to Spark, and guard the accelerated ones against future regressions.What changes are included in this PR?
Adds one SQL file test,
spark/src/test/resources/sql-tests/expressions/aggregate/regr.sql, covering all nineregr_*functions over global aggregates,GROUP BY, all-NULL input, and single-pair input (only rows where bothyandxare non-null contribute).regr_count,regr_avgx,regr_avgyrun natively. They use the defaultquerymode, which asserts the query executes on Comet without falling back to Spark and matches Spark exactly.regr_sxx,regr_syy,regr_sxy,regr_slope,regr_intercept,regr_r2currently fall back to Spark, so they usequery spark_answer_onlyto validate result correctness against Spark.How are these changes tested?
This PR is test-only. The new file runs under
CometSqlFileTestSuite, which executes each query through both Spark and Comet and compares results; the defaultqueryblocks additionally assert native (non-fallback) Comet execution. Verified locally:Result: the single discovered test file passes.