[MINOR][VL] Re-enable stale ignored atan2 test in MathFunctionsValidateSuite#12199
Conversation
|
@philo-he — tagging you as you reviewed a related change in PR #12158 which also touches This PR is independent of #12158 and can be merged directly without waiting for it. The three changes here (abstract→class, ANSI disable, atan2 un-ignore) are all self-contained correctness fixes with no external dependencies. PR #12158 (currently draft, pending facebookincubator/velox#17648) will be rebased on top of this once it merges, so the duplicate |
| // plan node. ANSI-specific behaviour is tested in MathFunctionsValidateSuiteAnsiOn. | ||
| override protected def sparkConf: SparkConf = { | ||
| super.sparkConf | ||
| .set(SQLConf.ANSI_ENABLED.key, "false") |
There was a problem hiding this comment.
Thanks for the PR. Could you verify whether the following environment variable setting is sufficient to make ANSI default to false?
There was a problem hiding this comment.
Thanks for digging into this. I investigated the full flow:
SPARK_ANSI_SQL_MODE: false is set as a GitHub Actions env variable in velox_backend_x86.yml but it never reaches Maven tests — the Spark 4.0 test jobs pass only -Dspark.test.home=... in DargLine, and the scalatest-maven-plugin config in pom.xml only forwards log4j.configurationFile as a system property. No Scala test code in the sparkConf chain reads the env var either.
So the env var is effectively documentation-only today, and spark.sql.ansi.enabled can only be controlled via the sparkConf override in test code.
The right fix would be to wire SPARK_ANSI_SQL_MODE into FunctionsValidateSuite.sparkConf:
val ansiEnabled = sys.env.getOrElse("SPARK_ANSI_SQL_MODE", "false")
super.sparkConf.set(SQLConf.ANSI_ENABLED.key, ansiEnabled)This propagates to all subclasses (no per-suite overrides needed), while MathFunctionsValidateSuiteAnsiOn can still override it back to true for ANSI-specific tests.
Would it make sense to raise a separate issue for this infrastructure fix? Happy to take it on as a follow-up. For this PR, should I keep the per-suite override as a self-contained fix, or would you prefer I address the root cause here directly?
There was a problem hiding this comment.
@brijrajk, my understanding is that the following Spark code reads this environment variable to determine the default value of the ANSI config. It only influences the default — if the user or test code sets the ANSI config explicitly, that setting takes precedence. Could you double-check if we still need an explicit setting? Thank you.
There was a problem hiding this comment.
Oh you are right @philo-he, turns out till this time I was testing it in an unintended way. Thanks for clearing that up and pointing me to how the ANSI config is passed — I had only looked at the Maven/Java property passing side and missed that Spark reads SPARK_ANSI_SQL_MODE directly in SQLConf to set the default. I have tested it now with SPARK_ANSI_SQL_MODE=false and the atan2 test passes. Removed the explicit config set in the Scala file.
7fce988 to
5d8af9c
Compare
philo-he
left a comment
There was a problem hiding this comment.
LGTM. Could you confirm if the CI failure is related? Thanks.
|
@philo-he — yes, the CI failure is related to our change, though indirectly. Here's the full analysis: Before this PR, This test was added in PR #12110 as a regression test for GLUTEN-11917 — which fixed a Spark 4.1-specific behavior where The fix is straightforward — add the version guard so the test only runs on Spark 4.1+: testWithMinSparkVersion("decimal arithmetic respects allowPrecisionLoss captured at view analysis time", "4.1") {Honestly, your question about the CI failure sent me down quite a rabbit hole — but a worthwhile one! It turned out our change was exposing a pre-existing gap in test scoping from PR #12110. Would it make sense to file a separate issue for the missing version guard and reference it here with a |
5d8af9c to
e1569aa
Compare
@brijrajk, If it's just a one-line change, fixing it here seems fine. Thanks. |
…teSuite The atan2 test was marked ignore after a result mismatch (PR apache#1689, 2023) caused by Velox using std::atan2 directly. That was fixed upstream in oap-project/velox#263 which added sparksql::Atan2Function that mirrors Spark's Math.atan2(y + 0.0, x + 0.0) behaviour to normalise -0 inputs. The ignore was never removed after the fix landed. Also promotes MathFunctionsValidateSuite from abstract class to class (fixing the RAS-removal oversight from PR apache#11756, the same fix already applied to DateFunctionsValidateSuite) and disables ANSI mode for Spark 4, consistent with the approach in PR apache#12158 which adds further tests to this same suite.
e1569aa to
ba867d7
Compare
0df8bea to
ba867d7
Compare
What changes are proposed in this pull request?
The
atan2test inMathFunctionsValidateSuitewas markedignorein 2023 after a result mismatch — Velox's implementation was usingstd::atan2directly, which handles-0inputs differently from Spark'sMath.atan2(y + 0.0, x + 0.0).That was fixed upstream in oap-project/velox#263, which added
sparksql::Atan2Functionthat normalises-0inputs to match Spark's exact behaviour. Theignoreannotation was never removed after the fix landed, leaving a valid test permanently skipped.This PR re-enables the test by changing
ignoretotest.Also promotes
MathFunctionsValidateSuitefromabstract classtoclass— a leftover from PR #11756 (RAS removal) which deleted the only concrete subclasses but missed this suite (the same fix was correctly applied toDateFunctionsValidateSuitein that PR). ANSI mode is disabled for Spark 4 compatibility, consistent with the approach taken in PR #12158 which adds further tests to this same suite.How was this patch tested?
The re-enabled test runs
SELECT atan2(double_field1, 0) from datatab limit 1and verifies native execution viacheckGlutenPlan[ProjectExecTransformer], comparing results against vanilla Spark.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude (Anthropic)