olaky commented on code in PR #36654:
URL: https://github.com/apache/spark/pull/36654#discussion_r883695655
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/finishAnalysis.scala:
##########
@@ -72,30 +73,34 @@ object RewriteNonCorrelatedExists extends Rule[LogicalPlan]
{
* Computes the current date and time to make sure we return the same result
in a single query.
*/
object ComputeCurrentTime extends Rule[LogicalPlan] {
- def apply(plan: LogicalPlan): LogicalPlan = {
- val currentDates = mutable.Map.empty[String, Literal]
- val timeExpr = CurrentTimestamp()
- val timestamp = timeExpr.eval(EmptyRow).asInstanceOf[Long]
- val currentTime = Literal.create(timestamp, timeExpr.dataType)
+ def apply(plan: LogicalPlan): LogicalPlan = applyWithTimestamp(plan,
Instant.now())
+
+ /** Required to build custom rules for commands that do not keep sub-plans
as children in Delta */
+ def applyWithTimestamp(plan: LogicalPlan, instant: Instant): LogicalPlan = {
+ val currentTimestamp = instantToMicros(instant)
Review Comment:
The idea here is to be able to apply this code to multiple plans using the
same instant (see comment above)
--
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]