Skip to content

[SPARK-46331][SQL][FOLLOWUP] Time travel should support current datetime functions#45476

Closed
cloud-fan wants to merge 1 commit intoapache:masterfrom
cloud-fan:time-travel
Closed

[SPARK-46331][SQL][FOLLOWUP] Time travel should support current datetime functions#45476
cloud-fan wants to merge 1 commit intoapache:masterfrom
cloud-fan:time-travel

Conversation

@cloud-fan
Copy link
Contributor

What changes were proposed in this pull request?

This is a followup of #44261 to fix one regression: we missed one exception that time travel needs to evaluate current datetime functions before the analysis phase completes. This PR fixes it by explicitly compute current datetime values in the time travel handling.

Why are the changes needed?

re-support current datetime functions as time travel timestamp

Does this PR introduce any user-facing change?

no, the regression has not been released yet.

How was this patch tested?

new test

Was this patch authored or co-authored using generative AI tooling?

no

@github-actions github-actions bot added the SQL label Mar 12, 2024
@cloud-fan
Copy link
Contributor Author

cc @dbatomic @MaxGekk

ComputeCurrentTime(ReplaceExpressions(fakeProject)).asInstanceOf[Project]
.expressions.head.asInstanceOf[Alias].child
}
tsToEval.foreach {
Copy link
Contributor

Choose a reason for hiding this comment

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

Btw, seems like "pre-eval" is needed in a couple of places (e.g. inline tables).

In future, it would be good if we could add some helper that will do all the safe pre-evals:

  1. Runtime replaceable
  2. ComuteCurrentTime
  3. ReplaceCurrentTime

In short, there are places where finishAnalysis rules, which are part of QO phase, need to be executed before entering QO.

@MaxGekk
Copy link
Member

MaxGekk commented Mar 12, 2024

+1, LGTM. Merging to master.
Thank you, @cloud-fan and @dbatomic for review.

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.

3 participants

Comments