You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/10/06 11:11:53 UTC
[GitHub] [spark] cloud-fan commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps
cloud-fan commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r988901293
##########
sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala:
##########
@@ -2092,19 +2092,30 @@ class InsertSuite extends DataSourceTest with SharedSparkSession {
test("SPARK-33294: Add query resolved check before analyze InsertIntoDir") {
withTempPath { path =>
- val ex = intercept[AnalysisException] {
- sql(
- s"""
- |INSERT OVERWRITE DIRECTORY '${path.getAbsolutePath}' USING PARQUET
- |SELECT * FROM (
- | SELECT c3 FROM (
- | SELECT c1, c2 from values(1,2) t(c1, c2)
- | )
- |)
- """.stripMargin)
- }
- assert(ex.getErrorClass == "UNRESOLVED_COLUMN")
- assert(ex.messageParameters.head == "`c3`")
+ val insert = s"INSERT OVERWRITE DIRECTORY '${path.getAbsolutePath}' USING PARQUET"
+ checkError(
+ exception = intercept[AnalysisException] {
+ sql(
+ s"""
+ |$insert
+ |SELECT * FROM (
+ | SELECT c3 FROM (
+ | SELECT c1, c2 from values(1,2) t(c1, c2)
+ | )
+ |)
+ """.stripMargin)
+ },
+ errorClass = "UNRESOLVED_COLUMN",
+ errorSubClass = "WITH_SUGGESTION",
+ sqlState = "42000",
+ parameters = Map(
+ "objectName" -> "`c3`",
+ "proposal" ->
+ "`__auto_generated_subquery_name`.`c1`, `__auto_generated_subquery_name`.`c2`"),
+ context = ExpectedContext(
+ fragment = insert,
Review Comment:
@MaxGekk is it a bug? The error context should be `c3` in this case, instead of the INSERT statement.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org