Skip to content

Commit

Permalink
[SPARK-48348][SPARK-48376][FOLLOWUP][SQL] Replace parseScript with ru…
Browse files Browse the repository at this point in the history
…nSqlScript in SQL Scripting Interpreter test suite

### What changes were proposed in this pull request?
Previous [pull request](apache#47973) introduced new tests to `SqlScriptingInterpreterSuite` (among others) where accidentally `parseScript` was used instead of `runSqlScript`.
While the same exception would get thrown (since it happens in the parsing phase) it violates the consistency among the tests in this suite and adds unnecessary import, so it would be nice to change it.

### Why are the changes needed?
Changes are minor, they improve consistency among test suites for SQL scripting.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
This patch alters tests.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#48016 from davidm-db/interpreter_test_suite_fix.

Authored-by: David Milicevic <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
davidm-db authored and MaxGekk committed Sep 6, 2024
1 parent b5e345c commit d5b79c0
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ package org.apache.spark.sql.scripting
import org.apache.spark.SparkException
import org.apache.spark.sql.{AnalysisException, DataFrame, Dataset, QueryTest, Row}
import org.apache.spark.sql.catalyst.QueryPlanningTracker
import org.apache.spark.sql.catalyst.parser.CatalystSqlParser.parseScript
import org.apache.spark.sql.exceptions.SqlScriptingException
import org.apache.spark.sql.test.SharedSparkSession

@@ -575,7 +574,7 @@ class SqlScriptingInterpreterSuite extends QueryTest with SharedSparkSession {
|END""".stripMargin
checkError(
exception = intercept[SqlScriptingException] {
parseScript(sqlScriptText)
runSqlScript(sqlScriptText)
},
errorClass = "INVALID_LABEL_USAGE.ITERATE_IN_COMPOUND",
parameters = Map("labelName" -> "LBL"))
@@ -614,7 +613,7 @@ class SqlScriptingInterpreterSuite extends QueryTest with SharedSparkSession {
|END""".stripMargin
checkError(
exception = intercept[SqlScriptingException] {
parseScript(sqlScriptText)
runSqlScript(sqlScriptText)
},
errorClass = "INVALID_LABEL_USAGE.DOES_NOT_EXIST",
parameters = Map("labelName" -> "RANDOMLBL", "statementType" -> "LEAVE"))
@@ -629,7 +628,7 @@ class SqlScriptingInterpreterSuite extends QueryTest with SharedSparkSession {
|END""".stripMargin
checkError(
exception = intercept[SqlScriptingException] {
parseScript(sqlScriptText)
runSqlScript(sqlScriptText)
},
errorClass = "INVALID_LABEL_USAGE.DOES_NOT_EXIST",
parameters = Map("labelName" -> "RANDOMLBL", "statementType" -> "ITERATE"))

0 comments on commit d5b79c0

Please sign in to comment.