anew commented on code in PR #57612:
URL: https://github.com/apache/spark/pull/57612#discussion_r3670981957
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -1420,11 +1420,27 @@ class AstBuilder extends DataTypeAstBuilder
}
}
val keys =
visitIdentifierSeq(params.keys).map(UnresolvedAttribute.quoted)
- val deleteCondition = Option(params.autoCdcDeleteClause())
+
+ // The optional clauses may appear in any order after `KEYS (...)`, so
the grammar accepts
+ // each any number of times; reject an accidental repeat here rather
than silently taking
+ // the last occurrence.
+ checkDuplicateClauses(params.autoCdcDeleteClause(), "APPLY AS DELETE
WHEN", params)
+ checkDuplicateClauses(params.autoCdcSequenceByClause(), "SEQUENCE BY",
params)
+ checkDuplicateClauses(params.autoCdcColumnsClause(), "COLUMNS", params)
+ checkDuplicateClauses(params.autoCdcStoredAsClause(), "STORED AS SCD
TYPE", params)
+ checkDuplicateClauses(params.autoCdcTrackHistoryClause(), "TRACK HISTORY
ON", params)
+
+ val deleteCondition = params.autoCdcDeleteClause().asScala.headOption
.map(c => expression(c.deleteCondition))
- val sequencing = expression(params.autoCdcSequenceByClause().sequence)
- val columnsClause = Option(params.autoCdcColumnsClause())
+ // SEQUENCE BY is mandatory; the grammar no longer enforces its presence
(the clauses are an
Review Comment:
good point.
--
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]