[EPIC] Support ANSI mode
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### 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 https://github.com/apache/datafusion/pull/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_
Contributor guide
Research direction
The issue names no files or tests. Start by reviewing the session parameter introduced in PR #18635 and map the expression and function areas affected by invalid casts, overflow, division by zero, and malformed input. Done means configurable session-level behavior, consistent errors when enabled, and unchanged permissive behavior when disabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100