[GitHub] [spark] cloud-fan commented on a change in pull request #28326: [SPARK-27340][SS] Alias on TimeWindow expression cause watermark metadata lost
cloud-fan commented on a change in pull request #28326: URL: https://github.com/apache/spark/pull/28326#discussion_r415859659 ## File path: sql/core/src/main/scala/org/apache/spark/sql/Column.scala ## @@ -1040,17 +1034,11 @@ class Column(val expr: Expression) extends Logging { * df.select($"colA".name("colB")) * }}} * - * If the current column has metadata associated with it, this metadata will be propagated - * to the new column. If this not desired, use `as` with explicitly empty metadata. - * * @group expr_ops * @since 2.0.0 */ def name(alias: String): Column = withExpr { -normalizedExpr() match { - case ne: NamedExpression => Alias(expr, alias)(explicitMetadata = Some(ne.metadata)) Review comment: This was added by https://github.com/apache/spark/pull/8215. But looking at the added tests at that time, we just want to carry over the metadata from the child of `Alias`, which doesn't need this change as `Alias.metedata` can inherit its child's metadata. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28326: [SPARK-27340][SS] Alias on TimeWindow expression cause watermark metadata lost
cloud-fan commented on a change in pull request #28326: URL: https://github.com/apache/spark/pull/28326#discussion_r415531970 ## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala ## @@ -3262,10 +3262,21 @@ object CleanupAliases extends Rule[LogicalPlan] { def trimNonTopLevelAliases(e: Expression): Expression = e match { case a: Alias => - a.copy(child = trimAliases(a.child))( + val newChild = trimAliases(a.child) + // Specific logic for keeping the eventTime watermark metadata in the top level alias. Review comment: can we make it general? I think what we need to do is to propagate the alias metadata when there are contiguous Alias nodes and we merge them into one. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org