davidm-db commented on code in PR #49726:
URL: https://github.com/apache/spark/pull/49726#discussion_r1935515323
##########
sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecution.scala:
##########
@@ -66,22 +88,20 @@ class SqlScriptingExecution(
None
}
- /**
- * Advances through the script and executes statements until a result
statement or
- * end of script is encountered.
- *
- * To know if there is result statement available, the method has to advance
through script and
- * execute statements until the result statement or end of script is
encountered. For that reason
- * the returned result must be executed before subsequent calls. Multiple
calls without executing
- * the intermediate results will lead to incorrect behavior.
- *
- * @return Result DataFrame if it is available, otherwise None.
- */
- def getNextResult: Option[DataFrame] = {
+ /** Helper method to get the next result statement from the script. */
+ private def getNextResultInternal: Option[DataFrame] = {
var currentStatement = getNextStatement
// While we don't have a result statement, execute the statements.
while (currentStatement.isDefined) {
currentStatement match {
+ case Some(signalStatementExec: SignalStatementExec) =>
+ throw new SqlScriptingRuntimeException(
+ condition = signalStatementExec.errorCondition,
+ sqlState = signalStatementExec.sqlState,
+ message = signalStatementExec.getMessageText,
+ cause = null,
+ origin = CurrentOrigin.get
+ )
case Some(stmt: SingleStatementExec) if !stmt.isExecuted =>
withErrorHandling {
Review Comment:
we don't need this `withErrorHandling` now that we have added `try/catch` to
`getNextResult`
--
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]