Skip to content

fix: preserve Spark next_day whitespace validation#22720

Open
xfocus3 wants to merge 1 commit into
apache:mainfrom
xfocus3:fix/spark-next-day-no-trim-22717
Open

fix: preserve Spark next_day whitespace validation#22720
xfocus3 wants to merge 1 commit into
apache:mainfrom
xfocus3:fix/spark-next-day-no-trim-22717

Conversation

@xfocus3
Copy link
Copy Markdown

@xfocus3 xfocus3 commented Jun 2, 2026

Which issue does this PR close?

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>
@github-actions github-actions Bot added the spark label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[datafusion-spark] next_day trims whitespace from dayOfWeek; Spark does not

1 participant