-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: support Spark-compatible abs math function part 2 - ANSI mode #18828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| // hardcode target partitions so plans are deterministic | ||
| .with_target_partitions(4); | ||
| .with_target_partitions(4) | ||
| .with_enable_ansi_mode(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turn on ANSI mode here so that sqllogictest show overflow error. We need a different way to toggle ANSI mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just set it like so instead?
datafusion/datafusion/sqllogictest/test_files/cte.slt
Lines 45 to 47 in f1ecacc
| # Test disabling recursive CTE | |
| statement ok | |
| set datafusion.execution.enable_recursive_ctes = false; |
Instead of doing it globally
88ca183 to
94cf2a8
Compare
| // hardcode target partitions so plans are deterministic | ||
| .with_target_partitions(4); | ||
| .with_target_partitions(4) | ||
| .with_enable_ansi_mode(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just set it like so instead?
datafusion/datafusion/sqllogictest/test_files/cte.slt
Lines 45 to 47 in f1ecacc
| # Test disabling recursive CTE | |
| statement ok | |
| set datafusion.execution.enable_recursive_ctes = false; |
Instead of doing it globally
| eval_legacy_mode!(Float64, -0.0f64, 0.0f64); | ||
| } | ||
|
|
||
| macro_rules! eval_ansi_mode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't help but feel a lot of this test code could be compacted in some way, as it seems quite verbose; haven't had time to properly check this however so don't really have a suggestion myself 🤔
Which issue does this PR close?
datafusion-sparkSpark Compatible Functions #15914Rationale for this change
absmath functionWhat changes are included in this PR?
absthrows exception on arithmetic overflow.Are these changes tested?
with_enable_ansi_modeintest_context.rsto demonstrate how ANSI mode works. This is probably not a good idea and should revert it after review.Are there any user-facing changes?
Yes, arithmetic overflow will be thrown when ANSI mode is on, i.e.
spark.sql.ansi.enabled=true