johanl-db commented on code in PR #38400: URL: https://github.com/apache/spark/pull/38400#discussion_r1008270419
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala: ########## @@ -451,7 +451,22 @@ class AstBuilder extends SqlBaseParserBaseVisitor[AnyRef] with SQLConfHelper wit } } } - if (matchedActions.isEmpty && notMatchedActions.isEmpty) { + val notMatchedBySourceActions = ctx.notMatchedBySourceClause().asScala.map { + clause => { + val notMatchedBySourceAction = clause.notMatchedBySourceAction() + if (notMatchedBySourceAction.DELETE() != null) { + DeleteAction(Option(clause.notMatchedBySourceCond).map(expression)) + } else if (notMatchedBySourceAction.UPDATE() != null) { + val condition = Option(clause.notMatchedBySourceCond).map(expression) + UpdateAction(condition, + withAssignments(clause.notMatchedBySourceAction().assignmentList())) + } else { + // It should not be here. + throw QueryParsingErrors.unrecognizedNotMatchedBySourceActionError(clause) Review Comment: Parsing will fail if a user tries to use an invalid action. We don't cover this error in tests since it can't surface unless there's a bug. I replaced it (and similar error for matched / not matched) with internal errors. -- 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: reviews-unsubscr...@spark.apache.org 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