Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spark] Current Date/Time resolution in constraints #2766

Merged
merged 4 commits into from
Mar 21, 2024

Conversation

andreaschat-db
Copy link
Contributor

@andreaschat-db andreaschat-db commented Mar 19, 2024

Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Description

Heading towards the removal of codegenFallback from Date/Time expressions (apache/spark#44261), delta constraints need to resolve current_datetime expressions during the analysis of the invariants. The proposed changes work for both Spark 3.5 and Spark master.

How was this patch tested?

Existing tests. In particular, CheckConstaintsSuite covers constraints with current_timestamp() expressions. Added an extra test to cover current_date().

Does this PR introduce any user-facing changes?

No.

@andreaschat-db andreaschat-db changed the title Current Time resolution in constraints [Spark] Current Date/Time resolution in constraints Mar 19, 2024
@andreaschat-db andreaschat-db changed the title [Spark] Current Date/Time resolution in constraints [Spark] Current DateTime resolution in constraints Mar 19, 2024
Copy link
Contributor

@tdas tdas left a comment

Choose a reason for hiding this comment

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

any unit tests?

@andreaschat-db andreaschat-db changed the title [Spark] Current DateTime resolution in constraints [Spark] Current Date/Time resolution in constraints Mar 19, 2024
Copy link
Contributor

@tdas tdas left a comment

Choose a reason for hiding this comment

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

This is great. Thank you for making this such that it will work with both spark master and 3.5.

My only worry is that we are using optimizer.ComputeCurrentTime .. which is spark internal API, and there is a risk that this is not going to stable across spark versions.

@tdas tdas merged commit 9f040d4 into delta-io:master Mar 21, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants