Skip to content

Conversation

@cht42
Copy link
Contributor

@cht42 cht42 commented Jan 16, 2026

Which issue does this PR close?

Rationale for this change

Add support for spark https://spark.apache.org/docs/latest/api/sql/index.html#date_diff function

What changes are included in this PR?

Are these changes tested?

yes in SLT

Are there any user-facing changes?

yes

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) spark labels Jan 16, 2026
Ok(ExprSimplifyResult::Simplified(binary_expr(
end.cast_to(&DataType::Int32, info.schema())?,
Operator::Minus,
start.cast_to(&DataType::Int32, info.schema())?,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the argument data type is Date64 ? The signature allows it.
Date32 keeps the seconds since epoch, but Date64 keeps the milliseconds since epoch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh good catch ! updated and added tests for it

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

Labels

spark sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[datafusion-spark] Add date_diff function

3 participants