Skip to content

Commit

Permalink
renames
Browse files Browse the repository at this point in the history
  • Loading branch information
dusantism-db committed Jan 23, 2025
1 parent ccab52c commit 370bf65
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class SparkSession private(
script: CompoundBody,
args: Map[String, Expression] = Map.empty): DataFrame = {
val sse = new SqlScriptingExecution(script, this, args)
sse.runWithContext {
sse.withVariableManager {
var result: Option[Seq[Row]] = None

// We must execute returned df before calling sse.getNextResult again because sse.hasNext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.apache.spark.sql.catalyst.plans.logical.{CommandResult, CompoundBody}
* SQL scripting executor - executes script and returns result statements.
* This supports returning multiple result statements from a single script.
* The caller of the SqlScriptingExecution API must wrap the interpretation and execution of
* statements with the [[runWithContext]] method, and adhere to the contract of executing
* statements with the [[withVariableManager]] method, and adhere to the contract of executing
* the returned statement before continuing iteration. Executing the statement needs to be done
* inside withErrorHandling block.
*
Expand Down Expand Up @@ -55,14 +55,14 @@ class SqlScriptingExecution(
}

private val variableManager = new SqlScriptingVariableManager(context)
private val handle = SqlScriptingVariableManager.create(variableManager)
private val variableManagerHandle = SqlScriptingVariableManager.create(variableManager)

/**
* Handles scripting context creation/access/deletion. Calls to execution API must be wrapped
* with this method.
*/
def runWithContext[R](f: => R): R = {
handle.runWith(f)
def withVariableManager[R](f: => R): R = {
variableManagerHandle.runWith(f)
}

/** Helper method to iterate get next statements from the first available frame. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SqlScriptingExecutionSuite extends QueryTest with SharedSparkSession {
val compoundBody = spark.sessionState.sqlParser.parsePlan(sqlText).asInstanceOf[CompoundBody]

val sse = new SqlScriptingExecution(compoundBody, spark, args)
sse.runWithContext {
sse.withVariableManager {
val result: ListBuffer[Array[Row]] = ListBuffer.empty

var df = sse.getNextResult
Expand Down

0 comments on commit 370bf65

Please sign in to comment.