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 <david.milicevic@databricks.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
  • Loading branch information
davidm-db authored and IvanK-db committed Sep 19, 2024
1 parent ada5a2a commit 374f204
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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"))
Expand All @@ -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"))
Expand Down

0 comments on commit 374f204

Please sign in to comment.