Skip to content

Commit d4e5df8

Browse files
itholicMaxGekk
authored andcommitted
[SPARK-42303][SQL] Assign name to _LEGACY_ERROR_TEMP_1326
### What changes were proposed in this pull request? This PR proposes to assign name to _LEGACY_ERROR_TEMP_1326, "CANNOT_MODIFY_CONFIG". ### Why are the changes needed? We should assign proper name to _LEGACY_ERROR_TEMP_* ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? `./build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite*"` Closes apache#39873 from itholic/LEGACY_1326. Authored-by: itholic <haejoon.lee@databricks.com> Signed-off-by: Max Gekk <max.gekk@gmail.com>
1 parent 04550ed commit d4e5df8

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

core/src/main/resources/error/error-classes.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@
7676
"Could not load Protobuf class with name <protobufClassName>. <explanation>."
7777
]
7878
},
79+
"CANNOT_MODIFY_CONFIG" : {
80+
"message" : [
81+
"Cannot modify the value of the Spark config: <key>.",
82+
"See also '<docroot>/sql-migration-guide.html#ddl-statements'."
83+
],
84+
"sqlState" : "46110"
85+
},
7986
"CANNOT_PARSE_DECIMAL" : {
8087
"message" : [
8188
"Cannot parse decimal."
@@ -3510,12 +3517,6 @@
35103517
"Cannot modify the value of a static config: <key>."
35113518
]
35123519
},
3513-
"_LEGACY_ERROR_TEMP_1326" : {
3514-
"message" : [
3515-
"Cannot modify the value of a Spark config: <key>.",
3516-
"See also '<docroot>/sql-migration-guide.html#ddl-statements'."
3517-
]
3518-
},
35193520
"_LEGACY_ERROR_TEMP_1327" : {
35203521
"message" : [
35213522
"Command execution is not supported in runner <runner>."

sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,8 +2989,8 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase {
29892989

29902990
def cannotModifyValueOfSparkConfigError(key: String, docroot: String): Throwable = {
29912991
new AnalysisException(
2992-
errorClass = "_LEGACY_ERROR_TEMP_1326",
2993-
messageParameters = Map("key" -> key, "docroot" -> docroot))
2992+
errorClass = "CANNOT_MODIFY_CONFIG",
2993+
messageParameters = Map("key" -> toSQLConf(key), "docroot" -> docroot))
29942994
}
29952995

29962996
def commandExecutionInRunnerUnsupportedError(runner: String): Throwable = {

sql/core/src/test/scala/org/apache/spark/sql/internal/SQLConfSuite.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import java.util.TimeZone
2222
import org.apache.hadoop.fs.Path
2323
import org.apache.logging.log4j.Level
2424

25+
import org.apache.spark.SPARK_DOC_ROOT
2526
import org.apache.spark.sql._
2627
import org.apache.spark.sql.catalyst.parser.ParseException
2728
import org.apache.spark.sql.catalyst.util.DateTimeTestUtils.MIT
@@ -204,9 +205,11 @@ class SQLConfSuite extends QueryTest with SharedSparkSession {
204205
sql("RESET spark.app.id")
205206
assert(spark.conf.get("spark.app.id") === appId, "Should not change spark core ones")
206207
// spark core conf w/ entry registered
207-
val e1 = intercept[AnalysisException](sql("RESET spark.executor.cores"))
208-
val str_match = "Cannot modify the value of a Spark config: spark.executor.cores"
209-
assert(e1.getMessage.contains(str_match))
208+
checkError(
209+
exception = intercept[AnalysisException](sql("RESET spark.executor.cores")),
210+
errorClass = "CANNOT_MODIFY_CONFIG",
211+
parameters = Map("key" -> "\"spark.executor.cores\"", "docroot" -> SPARK_DOC_ROOT)
212+
)
210213

211214
// user defined settings
212215
sql("SET spark.abc=xyz")

0 commit comments

Comments
 (0)