You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/05/27 14:56:52 UTC

[GitHub] [spark] olaky commented on a diff in pull request #36654: [SPARK-39259] Evaluate timestamps consistently in subqueries

olaky commented on code in PR #36654:
URL: https://github.com/apache/spark/pull/36654#discussion_r883695110


##########
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 */

Review Comment:
   I refer to open source Delta. Command like [MergeIntoCommand](https://github.com/delta-io/delta/blob/532da849290f9fa63ccacfc176f39f6d4775035d/core/src/main/scala/org/apache/spark/sql/delta/commands/MergeIntoCommand.scala#L206) do not have source added a children, and this is also not possible to add easily. This is why the solution I am going for is a special rule which applies this code with a shared timestamp. For this rule, I would like to re-use the code from here



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org