Skip to content

[EPIC] Support ANSI mode #23929

Description

@comphead

Is your feature request related to a problem or challenge?

Description

Apache DataFusion currently follows permissive SQL semantics for many runtime errors (for example, invalid casts, arithmetic overflow, division by zero, and malformed input). To improve SQL compatibility and make behavior configurable, DataFusion should support an ANSI SQL evaluation mode.

ANSI mode would cause operations that encounter invalid input or runtime errors to return an error instead of silently producing NULL or another permissive result. This behavior is expected by users migrating from systems that support ANSI SQL semantics (such as Spark SQL with ANSI mode enabled) and enables stricter correctness guarantees.

Supporting ANSI mode should provide:

  • A configurable session-level ANSI mode.
  • Consistent error semantics across expressions and built-in functions.
  • Preservation of existing permissive behavior when ANSI mode is disabled.

This issue tracks adding the infrastructure and expression/function changes required to support ANSI mode throughout DataFusion.

The initial effort started with adding DataFusion parameter #18635 which is false by default

pub enable_ansi_mode: bool, default = false

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions