MaxGekk commented on code in PR #38998:
URL: https://github.com/apache/spark/pull/38998#discussion_r1045013373


##########
core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala:
##########
@@ -147,6 +147,18 @@ class SparkThrowableSuite extends SparkFunSuite {
     assert(rereadErrorClassToInfoMap == errorReader.errorInfoMap)
   }
 
+  test("Error class names should contain only capital letters, numbers and 
underscores") {
+    val allowedChars = "[A-Z0-9_]*"
+    errorReader.errorInfoMap.foreach { e =>
+      assert(e._1.matches(allowedChars))

Review Comment:
   This one doesn't show which error class among 1500 is invalid, see:
   ```
   e._1.matches(allowedChars) was false
   ScalaTestFailureLocation: org.apache.spark.SparkThrowableSuite at 
(SparkThrowableSuite.scala:153)
   org.scalatest.exceptions.TestFailedException: e._1.matches(allowedChars) was 
false
   ```
   Could you output the error class name:
   ```suggestion
         assert(e._1.matches(allowedChars), s"The error class is invalid: 
${e._1}")
   ```



##########
core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala:
##########
@@ -147,6 +147,18 @@ class SparkThrowableSuite extends SparkFunSuite {
     assert(rereadErrorClassToInfoMap == errorReader.errorInfoMap)
   }
 
+  test("Error class names should contain only capital letters, numbers and 
underscores") {
+    val allowedChars = "[A-Z0-9_]*"
+    errorReader.errorInfoMap.foreach { e =>
+      assert(e._1.matches(allowedChars))
+      e._2.subClass.map { s =>
+        s.keys.foreach { k =>
+          assert(k.matches(allowedChars))

Review Comment:
   ```suggestion
             assert(k.matches(allowedChars), s"The error sub-class is invalid: 
$k")
   ```



-- 
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-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to