pan3793 commented on code in PR #54946:
URL: https://github.com/apache/spark/pull/54946#discussion_r3464947022
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala:
##########
@@ -103,6 +103,22 @@ class SparkSqlParser extends AbstractSqlParser {
parseInternal(command, None)(toResult)
}
+ /**
+ * Split a SQL string into individual statements after expanding any `${...}`
+ * variable references. Variable substitution has to happen *before*
splitting
+ * because a substituted value may itself contain `;`, comments, or
+ * `BEGIN ... END` structure that affect statement boundaries.
+ *
+ * Parameter substitution is intentionally NOT applied here: the splitter
+ * runs at the top level of an interactive session / batch input, where there
+ * is no parameter context bound. If a caller does have a parameter context,
+ * they should pre-substitute the input and call this with the result.
+ */
+ override def splitStatements(sqlText: String): SqlStatementSplitResult = {
+ val variableSubstituted = substitutor.substitute(sqlText)
Review Comment:
> Suggest splitting the raw text ...
this causes problems, because `${...}` is illeage syntax for antlr parser ...
--
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]