HeartSaVioR commented on code in PR #52428:
URL: https://github.com/apache/spark/pull/52428#discussion_r2380631389
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -2076,6 +2077,38 @@ class AstBuilder extends DataTypeAstBuilder
query)
}
+ /**
+ * Add an [[EventTimeWatermark]] to a logical plan.
+ */
+ private def withWatermark(
+ ctx: WatermarkClauseContext,
+ query: LogicalPlan): LogicalPlan = withOrigin(ctx) {
+ val expression = visitNamedExpression(ctx.namedExpression())
+
+ if (expression.isInstanceOf[MultiAlias]) {
+ throw new AnalysisException(
+ errorClass = "CANNOT_USE_MULTI_ALIASES_IN_WATERMARK_CLAUSE",
+ messageParameters = Map()
+ )
+ }
+
+ val namedExpression = expression match {
+ case e: NamedExpression => e
+ case e: Expression => UnresolvedAlias(e)
+ }
+
+ // TODO: This seems to need to find the new expression by index. We can't
rely on exprId
+ // due to UnresolvedAlias. Are there better ways to do?
Review Comment:
Addressed. PTAL!
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]