Commit 574a1e6
fix: preserve Spark next_day whitespace validation (#22720)
## Which issue does this PR close?
- Closes #22717.
## Rationale for this change
Spark does not trim `dayOfWeek` before matching it in `next_day`, but
`datafusion-spark` currently does. That makes values like `' MO '`
succeed in DataFusion even though Spark treats them as invalid.
## What changes are included in this PR?
- remove the `.trim()` call from `spark_next_day`
- add a regression test proving whitespace-padded day names are rejected
## Are these changes tested?
- `cargo test -p datafusion-spark
next_day_rejects_whitespace_padded_day_names -- --nocapture`
- `cargo test -p datafusion-spark`
- `cargo fmt --all --check`
- `cargo clippy -p datafusion-spark --all-targets --all-features
--no-deps -- -D warnings`
Note: the broader package clippy invocation still reports an existing
unused import warning in untouched
`datafusion/core/src/execution/session_state.rs` on current main.
## Are there any user-facing changes?
Behavior now matches Spark for whitespace-padded `dayOfWeek` inputs in
`next_day`.
---------
Signed-off-by: xfocus3 <xfocus3@users.noreply.github.com>
Co-authored-by: xfocus3 <xfocus3@users.noreply.github.com>
Co-authored-by: Ahmed El amraouiyine <ahmed.elamraouiyine@vilavi.fr>1 parent e5f7af1 commit 574a1e6
2 files changed
Lines changed: 13 additions & 1 deletion
File tree
- datafusion
- spark/src/function/datetime
- sqllogictest/test_files/spark/datetime
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
282 | 288 | | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
| |||
0 commit comments