Github user uncleGen commented on a diff in the pull request:
https://github.com/apache/spark/pull/17052#discussion_r103385054
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -1119,11 +1119,16 @@ case class DecimalAggregates(conf: CatalystConf)
extends Rule[LogicalPlan] {
*/
object ConvertToLocalRelation extends Rule[LogicalPlan] {
def apply(plan: LogicalPlan): LogicalPlan = plan transform {
- case Project(projectList, LocalRelation(output, data))
+ case Project(projectList, lr @ LocalRelation(output, data))
if !projectList.exists(hasUnevaluableExpr) =>
val projection = new InterpretedProjection(projectList, output)
projection.initialize(0)
- LocalRelation(projectList.map(_.toAttribute), data.map(projection))
+ if (lr.isStreaming) {
+ LocalRelation(projectList.map(_.toAttribute), data.map(projection))
+ .setIncremental()
+ } else {
+ LocalRelation(projectList.map(_.toAttribute), data.map(projection))
+ }
}
--- End diff --
In a streaming query, we will transfrom stream source to a batch
`LocalRelation` whose `isStreaming` is true, so we should keep new
LocalRelation's `isStreaming` is true in this rule.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]