dbatomic commented on code in PR #45476:
URL: https://github.com/apache/spark/pull/45476#discussion_r1521631586


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TimeTravelSpec.scala:
##########
@@ -42,14 +44,19 @@ object TimeTravelSpec {
         throw QueryCompilationErrors.invalidTimestampExprForTimeTravel(
           "INVALID_TIME_TRAVEL_TIMESTAMP_EXPR.INPUT", ts)
       }
-      val tsToEval = ts.transform {
-        case r: RuntimeReplaceable => r.replacement
+      val tsToEval = {
+        val fakeProject = Project(Seq(Alias(ts, "ts")()), OneRowRelation())
+        
ComputeCurrentTime(ReplaceExpressions(fakeProject)).asInstanceOf[Project]
+          .expressions.head.asInstanceOf[Alias].child
+      }
+      tsToEval.foreach {

Review Comment:
   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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to