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/09/08 07:50:03 UTC

[GitHub] [spark] MaxGekk opened a new pull request, #37834: [WIP][SQL] Pass error message parameters to exceptions as a map

MaxGekk opened a new pull request, #37834:
URL: https://github.com/apache/spark/pull/37834

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'core/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   


-- 
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


[GitHub] [spark] cloud-fan commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r969145075


##########
core/src/main/java/org/apache/spark/memory/MemoryConsumer.java:
##########
@@ -154,8 +156,10 @@ private void throwOom(final MemoryBlock page, final long required) {
     }
     taskMemoryManager.showMemoryUsage();
     // checkstyle.off: RegexpSinglelineJava
-    throw new SparkOutOfMemoryError("UNABLE_TO_ACQUIRE_MEMORY",
-            new String[]{Long.toString(required), Long.toString(got)});
+    Map<String, String> params = new HashMap<String, String>();
+    params.put("requestedBytes", Long.toString(required));
+    params.put("receivedBytes", Long.toString(got));
+    throw new SparkOutOfMemoryError("UNABLE_TO_ACQUIRE_MEMORY", params);

Review Comment:
   shall we move it to `SparkCoreErrors`? Then we don't need to create a map in Java.



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968251674


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -188,13 +209,16 @@ private[spark] class SparkUnsupportedOperationException(
 private[spark] class SparkClassNotFoundException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],

Review Comment:
   This is tested by QueryExecutionErrorsSuite "INCOMPATIBLE_DATASOURCE_REGISTER: create table using an incompatible data source"



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r990073683


##########
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:
   Yes, it should be `c3`. The PR https://github.com/apache/spark/pull/37861 changes this in OSS.



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968234159


##########
core/src/main/java/org/apache/spark/memory/SparkOutOfMemoryError.java:
##########
@@ -38,15 +40,15 @@ public SparkOutOfMemoryError(OutOfMemoryError e) {
         super(e.getMessage());
     }
 
-    public SparkOutOfMemoryError(String errorClass, String[] messageParameters) {
+    public SparkOutOfMemoryError(String errorClass, Map<String, String> messageParameters) {
         super(SparkThrowableHelper.getMessage(errorClass, null, messageParameters));
         this.errorClass = errorClass;
         this.messageParameters = messageParameters;
     }
 
     @Override
     public String[] getMessageParameters() {
-        return messageParameters;
+        return SparkThrowableHelper.getMessageParameters(errorClass, null, messageParameters);

Review Comment:
   This is tested by ShuffleExternalSorterSuite "nested spill should be no-op"



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968279188


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -322,65 +349,59 @@ private[spark] class SparkIllegalArgumentException(
 private[spark] class SparkIndexOutOfBoundsException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String])
+    messageParameters: Map[String, String])
   extends IndexOutOfBoundsException(
     SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull, messageParameters))
-    with SparkThrowable {
+  with SparkThrowable {
 
-  override def getMessageParameters: Array[String] = messageParameters
-  override def getErrorClass: String = errorClass
-  override def getErrorSubClass: String = errorSubClass.orNull
-}
-
-/**
- * IO exception thrown from Spark with an error class.
- */
-private[spark] class SparkIOException(
-    errorClass: String,
-    errorSubClass: Option[String] = None,
-    messageParameters: Array[String])
-  extends IOException(
-    SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull, messageParameters))
-    with SparkThrowable {
+  override def getMessageParameters: Array[String] = {
+    SparkThrowableHelper.getMessageParameters(errorClass, errorSubClass.orNull, messageParameters)
+  }
 
-  override def getMessageParameters: Array[String] = messageParameters
   override def getErrorClass: String = errorClass
   override def getErrorSubClass: String = errorSubClass.orNull
 }
 
 private[spark] class SparkRuntimeException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],

Review Comment:
   This one is tested in many places.



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968272287


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -269,48 +305,39 @@ private[spark] class SparkFileNotFoundException(
 private[spark] class SparkNumberFormatException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],

Review Comment:
   The exception SparkNumberFormatException is used only once by the error class CAST_INVALID_INPUT which is tested by *.sql.



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968281170


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -408,14 +432,17 @@ private[spark] class SparkSecurityException(
 private[spark] class SparkArrayIndexOutOfBoundsException(

Review Comment:
   Pretty similar to SparkIndexOutOfBoundsException



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r969170705


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -128,13 +140,16 @@ private[spark] case class ExecutorDeadException(message: String)
 private[spark] class SparkUpgradeException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],
     cause: Throwable)
-  extends RuntimeException(SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull,
-    messageParameters), cause)
-    with SparkThrowable {
+  extends RuntimeException(
+    SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull, messageParameters), cause)
+  with SparkThrowable {
+
+  override def getMessageParameters: Array[String] = {
+    SparkThrowableHelper.getMessageParameters(errorClass, errorSubClass.orNull, messageParameters)

Review Comment:
   I agree. Let's do that in a separate PR.



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r969551311


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -408,14 +432,17 @@ private[spark] class SparkSecurityException(
 private[spark] class SparkArrayIndexOutOfBoundsException(

Review Comment:
   It has been removed by https://github.com/apache/spark/pull/37857



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968272614


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -269,48 +305,39 @@ private[spark] class SparkFileNotFoundException(
 private[spark] class SparkNumberFormatException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],
     context: Array[QueryContext],
     summary: String)
   extends NumberFormatException(
     SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull, messageParameters, summary))
-    with SparkThrowable {
+  with SparkThrowable {
+
+  override def getMessageParameters: Array[String] = {
+    SparkThrowableHelper.getMessageParameters(errorClass, errorSubClass.orNull, messageParameters)
+  }
 
-  override def getMessageParameters: Array[String] = messageParameters
   override def getErrorClass: String = errorClass
   override def getErrorSubClass: String = errorSubClass.orNull
   override def getQueryContext: Array[QueryContext] = context
 }
 
-/**
- * No such method exception thrown from Spark with an error class.
- */
-private[spark] class SparkNoSuchMethodException(

Review Comment:
   I removed it since it is not used at all.



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968256570


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -220,14 +247,17 @@ private[spark] class SparkConcurrentModificationException(
 private[spark] class SparkDateTimeException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],

Review Comment:
   This is tested at least by QueryExecutionAnsiErrorsSuite "CANNOT_PARSE_TIMESTAMP: parse string to timestamp"



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968280169


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -392,12 +413,15 @@ private[spark] class SparkRuntimeException(
 private[spark] class SparkSecurityException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String])
+    messageParameters: Map[String, String])

Review Comment:
   This is tested by QueryExecutionErrorsSuite "RESET_PERMISSION_TO_ORIGINAL: can't set permission"



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968283764


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -426,40 +453,24 @@ private[spark] class SparkArrayIndexOutOfBoundsException(
  */
 private[spark] class SparkSQLException(

Review Comment:
   This is used ONLY once, and tested by QueryExecutionErrorsSuite "UNRECOGNIZED_SQL_TYPE: unrecognized SQL type -100"



-- 
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


[GitHub] [spark] MaxGekk commented on pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on PR #37834:
URL: https://github.com/apache/spark/pull/37834#issuecomment-1245491727

   Merging to master. Thank you, @srielau @gengliangwang @cloud-fan for review.


-- 
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


[GitHub] [spark] MaxGekk closed pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk closed pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps
URL: https://github.com/apache/spark/pull/37834


-- 
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


[GitHub] [spark] MaxGekk commented on pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on PR #37834:
URL: https://github.com/apache/spark/pull/37834#issuecomment-1242641564

   @srielau @anchovYu Could you take a look at the PR, please.


-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968248298


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -128,13 +140,16 @@ private[spark] case class ExecutorDeadException(message: String)
 private[spark] class SparkUpgradeException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],

Review Comment:
   It is tested by at least QueryExecutionErrorsSuite "INCONSISTENT_BEHAVIOR_CROSS_VERSION: compatibility with Spark 2.4/3.2 in reading/writing dates".



-- 
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


[GitHub] [spark] gengliangwang commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
gengliangwang commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968968699


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -128,13 +140,16 @@ private[spark] case class ExecutorDeadException(message: String)
 private[spark] class SparkUpgradeException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],
     cause: Throwable)
-  extends RuntimeException(SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull,
-    messageParameters), cause)
-    with SparkThrowable {
+  extends RuntimeException(
+    SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull, messageParameters), cause)
+  with SparkThrowable {
+
+  override def getMessageParameters: Array[String] = {
+    SparkThrowableHelper.getMessageParameters(errorClass, errorSubClass.orNull, messageParameters)

Review Comment:
   @MaxGekk @srielau This line shows up many times in this PR.
   Do we consider further refactoring the parameters in `SparkThrowable`? E.g. combine `String[] getMessageParameters` and `String[] getParameterNames` into `Map<String, String> getMessageParameters`
   
   



-- 
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


[GitHub] [spark] cloud-fan commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968285919


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -468,19 +479,24 @@ private[spark] class SparkNoSuchElementException(
 private[spark] class SparkSQLFeatureNotSupportedException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String])
+    messageParameters: Map[String, String])

Review Comment:
   The exception is used ONLY once by the error class UNSUPPORTED_FEATURE.JDBC_TRANSACTION, but it is not tested at all. There is the JIRA https://issues.apache.org/jira/browse/SPARK-40391



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968274228


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -269,48 +305,39 @@ private[spark] class SparkFileNotFoundException(
 private[spark] class SparkNumberFormatException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],
     context: Array[QueryContext],
     summary: String)
   extends NumberFormatException(
     SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull, messageParameters, summary))
-    with SparkThrowable {
+  with SparkThrowable {
+
+  override def getMessageParameters: Array[String] = {
+    SparkThrowableHelper.getMessageParameters(errorClass, errorSubClass.orNull, messageParameters)
+  }
 
-  override def getMessageParameters: Array[String] = messageParameters
   override def getErrorClass: String = errorClass
   override def getErrorSubClass: String = errorSubClass.orNull
   override def getQueryContext: Array[QueryContext] = context
 }
 
-/**
- * No such method exception thrown from Spark with an error class.
- */
-private[spark] class SparkNoSuchMethodException(
-    errorClass: String,
-    errorSubClass: Option[String] = None,
-    messageParameters: Array[String])
-  extends NoSuchMethodException(
-    SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull, messageParameters))
-    with SparkThrowable {
-
-  override def getMessageParameters: Array[String] = messageParameters
-  override def getErrorClass: String = errorClass
-  override def getErrorSubClass: String = errorSubClass.orNull}
-
 /**
  * Illegal argument exception thrown from Spark with an error class.
  */
 private[spark] class SparkIllegalArgumentException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],

Review Comment:
   It is tested by QueryExecutionErrorsSuite "CONVERSION_INVALID_INPUT: to_binary conversion function"



-- 
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


[GitHub] [spark] MaxGekk commented on pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on PR #37834:
URL: https://github.com/apache/spark/pull/37834#issuecomment-1243234192

   @cloud-fan @gengliangwang Could you review this PR, please.


-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968266615


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -254,12 +287,15 @@ private[spark] class SparkFileAlreadyExistsException(
 private[spark] class SparkFileNotFoundException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String])
+    messageParameters: Map[String, String])

Review Comment:
   It is tested by QueryExecutionErrorsSuite "RENAME_SRC_PATH_NOT_FOUND: rename the file which source path does not exist"



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968250522


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -163,21 +181,24 @@ private[spark] class SparkArithmeticException(
 private[spark] class SparkUnsupportedOperationException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String])
+    messageParameters: Map[String, String])
   extends UnsupportedOperationException(
     SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull, messageParameters))
-    with SparkThrowable {
+  with SparkThrowable {
 
   def this(
       errorClass: String,
       errorSubClass: String,
-      messageParameters: Array[String]) =
+      messageParameters: Map[String, String]) =
     this(
       errorClass = errorClass,
       errorSubClass = Some(errorSubClass),
       messageParameters = messageParameters)
 
-  override def getMessageParameters: Array[String] = messageParameters
+  override def getMessageParameters: Array[String] = {

Review Comment:
   It is tested by QueryExecutionErrorsSuite "UNSUPPORTED_FEATURE: unsupported pivot operations"



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968255031


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -204,13 +228,16 @@ private[spark] class SparkClassNotFoundException(
 private[spark] class SparkConcurrentModificationException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],

Review Comment:
   The exception is used only once to raise the error class `CONCURRENT_QUERY` but the last one is not tested at all. I open the JIRA https://issues.apache.org/jira/browse/SPARK-40408 to add a test for it.



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968249355


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -144,14 +159,17 @@ private[spark] class SparkUpgradeException(
 private[spark] class SparkArithmeticException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],

Review Comment:
   It is tested by at least QueryExecutionErrorsSuite "CAST_OVERFLOW: from long to ANSI intervals"



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968246698


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -29,31 +29,32 @@ class SparkException(
     cause: Throwable,
     errorClass: Option[String],
     errorSubClass: Option[String],
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],

Review Comment:
   It is tested by at least QueryExecutionErrorsSuite "INVALID_BUCKET_FILE: error if there exists any malformed bucket files"



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968278252


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -322,65 +349,59 @@ private[spark] class SparkIllegalArgumentException(
 private[spark] class SparkIndexOutOfBoundsException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String])
+    messageParameters: Map[String, String])

Review Comment:
   The exception is used only once by the error class INDEX_OUT_OF_BOUNDS which is not tested. There is the JIRA https://issues.apache.org/jira/browse/SPARK-38734 for testing.



-- 
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


[GitHub] [spark] cloud-fan commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r969146280


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -128,13 +140,16 @@ private[spark] case class ExecutorDeadException(message: String)
 private[spark] class SparkUpgradeException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],
     cause: Throwable)
-  extends RuntimeException(SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull,
-    messageParameters), cause)
-    with SparkThrowable {
+  extends RuntimeException(
+    SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull, messageParameters), cause)
+  with SparkThrowable {
+
+  override def getMessageParameters: Array[String] = {
+    SparkThrowableHelper.getMessageParameters(errorClass, errorSubClass.orNull, messageParameters)

Review Comment:
   +1. These 2 methods were added by https://github.com/apache/spark/pull/36693 and not released yet. We can still change it.



-- 
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


[GitHub] [spark] cloud-fan commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r969190054


##########
core/src/main/java/org/apache/spark/memory/MemoryConsumer.java:
##########
@@ -18,7 +18,10 @@
 package org.apache.spark.memory;
 
 import java.io.IOException;
+import java.util.HashMap;

Review Comment:
   unused imports



-- 
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


[GitHub] [spark] srielau commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
srielau commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968478113


##########
core/src/main/resources/error/error-classes.json:
##########
@@ -490,7 +490,7 @@
   },
   "UNRESOLVED_MAP_KEY" : {
     "message" : [
-      "Cannot resolve column <columnName> as a map key. If the key is a string literal, please add single quotes around it."
+      "Cannot resolve column <objectName> as a map key. If the key is a string literal, please add single quotes around it."

Review Comment:
   Note: we will not get away with renaming parameter names in the long run, once third parties start building dependencies on the API.



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968237892


##########
core/src/main/resources/error/error-classes.json:
##########
@@ -490,7 +490,7 @@
   },
   "UNRESOLVED_MAP_KEY" : {
     "message" : [
-      "Cannot resolve column <columnName> as a map key. If the key is a string literal, please add single quotes around it."
+      "Cannot resolve column <objectName> as a map key. If the key is a string literal, please add single quotes around it."

Review Comment:
   I renamed it because there is another error class which shares the same function in source code, and it has the same structure and the first parameter `objectName`. Having the same name simplifies the implementation.



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968262076


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -239,12 +269,15 @@ private[spark] class SparkDateTimeException(
 private[spark] class SparkFileAlreadyExistsException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String])
+    messageParameters: Map[String, String])

Review Comment:
   The exception is used only once by the error class FAILED_RENAME_PATH but it is not tested at all. There is the JIRA for testing https://issues.apache.org/jira/browse/SPARK-38728



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968278824


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -322,65 +349,59 @@ private[spark] class SparkIllegalArgumentException(
 private[spark] class SparkIndexOutOfBoundsException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String])
+    messageParameters: Map[String, String])
   extends IndexOutOfBoundsException(
     SparkThrowableHelper.getMessage(errorClass, errorSubClass.orNull, messageParameters))
-    with SparkThrowable {
+  with SparkThrowable {
 
-  override def getMessageParameters: Array[String] = messageParameters
-  override def getErrorClass: String = errorClass
-  override def getErrorSubClass: String = errorSubClass.orNull
-}
-
-/**
- * IO exception thrown from Spark with an error class.
- */
-private[spark] class SparkIOException(

Review Comment:
   Removed since it is not used.



-- 
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


[GitHub] [spark] MaxGekk commented on a diff in pull request #37834: [SPARK-40400][SQL] Pass error message parameters to exceptions as maps

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on code in PR #37834:
URL: https://github.com/apache/spark/pull/37834#discussion_r968282324


##########
core/src/main/scala/org/apache/spark/SparkException.scala:
##########
@@ -408,14 +432,17 @@ private[spark] class SparkSecurityException(
 private[spark] class SparkArrayIndexOutOfBoundsException(
     errorClass: String,
     errorSubClass: Option[String] = None,
-    messageParameters: Array[String],
+    messageParameters: Map[String, String],

Review Comment:
   This is tested by QueryExecutionAnsiErrorsSuite "INVALID_ARRAY_INDEX: get element from array"



-- 
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