From b687e581bf1b96fa5c35c19cbab2dd2f28ced618 Mon Sep 17 00:00:00 2001 From: Milan Dankovic Date: Tue, 26 Nov 2024 15:04:48 +0100 Subject: [PATCH] Style changes --- .../src/main/scala/org/apache/spark/sql/SparkSession.scala | 1 + .../apache/spark/sql/scripting/SqlScriptingExecution.scala | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala b/sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala index 20d0bddcbfd0a..4520cbeaa1521 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala @@ -415,6 +415,7 @@ class SparkSession private( /** * Executes given script and return the result of the last statement. + * If script contains no queries, an empty `DataFrame` is returned. * * @param script A SQL script to execute. * @param args A map of parameter names to SQL literal expressions. diff --git a/sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecution.scala b/sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecution.scala index d124e3d484c71..9fa70156125c6 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecution.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/scripting/SqlScriptingExecution.scala @@ -44,9 +44,7 @@ class SqlScriptingExecution( override def hasNext: Boolean = current.isDefined override def next(): DataFrame = { - if (!hasNext) {throw SparkException.internalError( - "No more elements to iterate through.") - } + if (!hasNext) throw SparkException.internalError("No more elements to iterate through.") val nextDataFrame = current.get current = getNextResult nextDataFrame