This is an automated email from the ASF dual-hosted git repository.

maxgekk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 9d2fd5e328fd [SPARK-47179][SQL] Improve error message from 
SparkThrowableSuite for better debuggability
9d2fd5e328fd is described below

commit 9d2fd5e328fd298e8522a7bb9f96c7f014b8f145
Author: Haejoon Lee <haejoon....@databricks.com>
AuthorDate: Tue Feb 27 15:51:42 2024 +0300

    [SPARK-47179][SQL] Improve error message from SparkThrowableSuite for 
better debuggability
    
    ### What changes were proposed in this pull request?
    
    This PR proposes to improve error message from SparkThrowableSuite for 
better debuggability
    
    ### Why are the changes needed?
    
    The current error message is not very actionable for developer who need 
regenerating the error class documentation.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No API change, but the error message is changed:
    
    **Before**
    ```
    The error class document is not up to date. Please regenerate it.
    ```
    
    **After**
    ```
    he error class document is not up to date. Please regenerate it by running 
`SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "core/testOnly *SparkThrowableSuite -- 
-t \"Error classes match with document\""`
    ```
    
    ### How was this patch tested?
    
    The existing CI should pass.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #45273 from itholic/improve_error_suite_debuggability.
    
    Authored-by: Haejoon Lee <haejoon....@databricks.com>
    Signed-off-by: Max Gekk <max.g...@gmail.com>
---
 .../test/scala/org/apache/spark/SparkThrowableSuite.scala    | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala 
b/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala
index 1f3b28968025..f41ad8fffd3e 100644
--- a/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala
+++ b/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala
@@ -55,6 +55,9 @@ class SparkThrowableSuite extends SparkFunSuite {
         "core/testOnly *SparkThrowableSuite -- -t \"Error classes match with 
document\""
    }}}
    */
+  private val regenerateCommand = "SPARK_GENERATE_GOLDEN_FILES=1 build/sbt " +
+    "\"core/testOnly *SparkThrowableSuite -- -t \\\"Error classes match with 
document\\\"\""
+
   private val errorJsonFilePath = getWorkspaceFilePath(
     "common", "utils", "src", "main", "resources", "error", 
"error-classes.json")
 
@@ -328,7 +331,8 @@ class SparkThrowableSuite extends SparkFunSuite {
         }
       } else {
         assert(subErrorDoc.trim == errorsInDoc.trim,
-          "The error class document is not up to date. Please regenerate it.")
+          "The error class document is not up to date. " +
+            s"Please regenerate it by running `$regenerateCommand`")
       }
     })
 
@@ -351,7 +355,8 @@ class SparkThrowableSuite extends SparkFunSuite {
       }
     } else {
       assert(sqlErrorParentDoc.trim == commonErrorsInDoc.trim,
-        "The error class document is not up to date. Please regenerate it.")
+        "The error class document is not up to date. " +
+          s"Please regenerate it by running `$regenerateCommand`")
     }
 
     val orphans = orphanedGoldenFiles()
@@ -368,7 +373,8 @@ class SparkThrowableSuite extends SparkFunSuite {
       }
     } else {
       assert(orphans.isEmpty,
-        "Exist orphaned error class documents. Please regenerate it.")
+        "Exist orphaned error class documents. " +
+          s"Please regenerate it by running `$regenerateCommand`")
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to