fix: query tolerance= in SQL file tests now also asserts Comet native execution#3797
Open
andygrove wants to merge 4 commits intoapache:mainfrom
Open
fix: query tolerance= in SQL file tests now also asserts Comet native execution#3797andygrove wants to merge 4 commits intoapache:mainfrom
andygrove wants to merge 4 commits intoapache:mainfrom
Conversation
… execution The WithTolerance mode in CometSqlFileTestSuite called checkSparkAnswerWithTolerance, which hardcodes assertCometNative=false. This meant that all 50+ SQL test queries using 'query tolerance=...' (sin, cos, tan, stddev, avg, etc.) silently skipped the check that Comet actually executed the expression natively. Add checkSparkAnswerAndOperatorWithTolerance that combines tolerance- based result comparison with the native operator assertion, and use it in the WithTolerance case.
2 tasks
Maps Spark's Logarithm expression to DataFusion's log(base, value) function. Applies nullIfNegative to both base and value to match Spark's behavior of returning null when the result would be NaN (inputs <= 0).
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?
Closes #.
Rationale for this change
CometSqlFileTestSuitesupports aquery tolerance=<value>directive for floating-point queries where small numeric differences are expected. However, theWithTolerancemode calledcheckSparkAnswerWithTolerance, which hardcodesassertCometNative = false. This meant that all 50+ queries using this directive (coveringsin,cos,tan,asin,acos,atan,atan2,sinh,cosh,tanh,exp,expm1,log,log2,log10,pow,sqrt,cot,stddev,variance,avg,sum,corr,covariance) were silently skipping the assertion that Comet actually executed the expression natively.What changes are included in this PR?
checkSparkAnswerAndOperatorWithTolerancetoCometTestBase, which combines tolerance-based result comparison withassertCometNative = true.WithTolerancecase inCometSqlFileTestSuiteto call the new method instead ofcheckSparkAnswerWithTolerance.tan.sqlto addallowIncompatibleconfig so the test runs natively.Logarithmexpression (two-arglog(base, value)), mapping it to DataFusion'slog(base, value)function.How are these changes tested?
The existing SQL file tests for all affected math and aggregate expressions now enforce native execution as part of their normal CI run.