xuanyuanking commented on a change in pull request #24457:
[SPARK-27340][Streaming] Alias on TimeWindow expression may cause watermark
metadata lost
URL: https://github.com/apache/spark/pull/24457#discussion_r281443354
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/Column.scala
##########
@@ -1001,17 +1001,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 {
- expr match {
- case ne: NamedExpression => Alias(expr, alias)(explicitMetadata =
Some(ne.metadata))
- case other => Alias(other, alias)()
- }
+ Alias(expr, alias)()
Review comment:
Related tests maybe not enough, as your change, `as` function has a
different behavior, `metadata` no longer pass to `explicitMetadata`. My
suggestion:
1. For safety, run all test, not only the related.
2. Do the fix just for SS scenario.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]