dongjoon-hyun 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_r250328839
##########
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:
@HeartSaVioR . I prefer to leverage the existing lines (501 ~ 509) as you
said like the following. I assume that the following is what you mean.
Eventually, it's two line changes (excluding comments). WDYT?
```scala
// Rewire the plan to use the new attributes that were returned by the
source.
val newAttributePlan = newBatchesPlan transformAllExpressions {
case ct: CurrentTimestamp =>
CurrentBatchTimestamp(offsetSeqMetadata.batchTimestampMs,
- ct.dataType)
+ ct.dataType).toLiteral
case cd: CurrentDate =>
CurrentBatchTimestamp(offsetSeqMetadata.batchTimestampMs,
- cd.dataType, cd.timeZoneId)
+ cd.dataType, cd.timeZoneId).toLiteral
}
```
----------------------------------------------------------------
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]