Skip to content

Conversation

@hsiang-c
Copy link
Contributor

@hsiang-c hsiang-c commented Nov 19, 2025

Which issue does this PR close?

Rationale for this change

Non-ANSI mode ANSI mode ANSI Interval Types
#18205 This PR TODO
  • Support ANSI mode Spark-compatible abs math function

What changes are included in this PR?

Are these changes tested?

  • unit tests
  • SQL logic tests
    • I had to turn on with_enable_ansi_mode in test_context.rs to 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

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) execution Related to the execution crate functions Changes to functions implementation spark labels Nov 19, 2025
// hardcode target partitions so plans are deterministic
.with_target_partitions(4);
.with_target_partitions(4)
.with_enable_ansi_mode(true);
Copy link
Contributor Author

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.

Copy link
Contributor

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?

# Test disabling recursive CTE
statement ok
set datafusion.execution.enable_recursive_ctes = false;

Instead of doing it globally

@hsiang-c
Copy link
Contributor Author

@Jefffrey @comphead for review, thank you.

// hardcode target partitions so plans are deterministic
.with_target_partitions(4);
.with_target_partitions(4)
.with_enable_ansi_mode(true);
Copy link
Contributor

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?

# 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 {
Copy link
Contributor

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 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

execution Related to the execution crate functions Changes to functions implementation spark sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants