cloud-fan commented on code in PR #49726:
URL: https://github.com/apache/spark/pull/49726#discussion_r1952766998
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -288,6 +288,53 @@ class AstBuilder extends DataTypeAstBuilder
ExceptionHandler(exceptionHandlerTriggers, body, handlerType)
}
+ override def visitSignalStatementWithCondition(
+ ctx: SignalStatementWithConditionContext): SignalStatement = {
+ // Parse message text value which can either be a string literal or
variable.
+ val messageString = Option(ctx.msgStr)
+ .map(sl => Left(string(visitStringLit(sl))))
+ val messageVariable = Option(ctx.msgVar)
+ .map(mpi => Right(UnresolvedAttribute(visitMultipartIdentifier(mpi))))
+
+ // Parse message arguments which are represented by a variable of type
"MAP<STRING, STRING>".
+ val messageArguments = Option(ctx.argVar)
+ .map(mpi => UnresolvedAttribute(visitMultipartIdentifier(mpi)))
+
+ // isBuiltinError is false because we need to resolve it based on the
value of errorCondition.
+ // sqlState is None because we need to resolve it based on the value of
errorCondition.
+ // This is done in visitCompoundBodyImpl once all conditions have been
resolved.
+ SignalStatement(
+ isBuiltinError = false,
+ errorCondition =
Some(ctx.conditionName.getText.toUpperCase(Locale.ROOT)),
Review Comment:
nit: call `visitMultipartIdentifier` and then call `mkString(".")`
--
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]