HeartSaVioR commented on a change in pull request #23609: [SPARK-26379][SS] Fix 
issue on adding current_timestamp/current_date to streaming query
URL: https://github.com/apache/spark/pull/23609#discussion_r250384319
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/MicroBatchExecution.scala
 ##########
 @@ -508,12 +508,21 @@ class MicroBatchExecution(
           cd.dataType, cd.timeZoneId)
     }
 
+    // Pre-resolve new attributes to ensure all attributes are resolved before
+    // accessing schema of logical plan. Note that it only leverages the 
information
+    // of attributes, so we don't need to concern about the value of literals.
+
+    val newAttrPlanPreResolvedForSchema = newAttributePlan 
transformAllExpressions {
 
 Review comment:
   @dongjoon-hyun 
   Actually I meant we pass `newBatchesPlan` instead of `newAttributePlan` only 
for extracting schema since we actually guess the name and data type will not 
be changed from IncrementalExecution. But IMHO I feel safer pre-transforming it.
   
   Transforming CurrentBatchTimestamp to Literal not in IncrementalExecution 
breaks the intention what CurrentBatchTimestamp javadoc describes. Please note 
that I used transformed plan only for extracting schema and the actual plan is 
not changed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to