Skip to content

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

Merged
tdas merged 4 commits intodelta-io:masterfrom
andreaschat-db:test
Mar 21, 2024
Merged

[Spark] Current Date/Time resolution in constraints#2766
tdas merged 4 commits intodelta-io:masterfrom
andreaschat-db:test

Conversation

@andreaschat-db
Copy link
Copy Markdown
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
Copy Markdown
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 requested a review from tdas March 19, 2024 16:08
@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
Copy Markdown
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
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.

4 participants