Hisoka-X commented on code in PR #41865:
URL: https://github.com/apache/spark/pull/41865#discussion_r1253830314


##########
core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala:
##########
@@ -141,54 +149,167 @@ class SparkThrowableSuite extends SparkFunSuite {
     checkIfUnique(messageFormats)
   }
 
-  test("SPARK-44268: Error classes match with document") {
-    val sqlstateDoc = "sql-error-conditions-sqlstates.md"
+  test("Error classes match with document") {
     val errors = errorReader.errorInfoMap
-    val errorDocPaths = getWorkspaceFilePath("docs").toFile
-      .listFiles(_.getName.startsWith("sql-error-conditions-"))
-      .filter(!_.getName.equals(sqlstateDoc))
-      .map(f => IOUtils.toString(f.toURI, 
StandardCharsets.UTF_8)).map(_.split("\n"))
-    // check the error classes in document should be in error-classes.json
-    val linkInDocRegex = "\\[(.*)\\]\\((.*)\\)".r
-    val commonErrorsInDoc = IOUtils.toString(getWorkspaceFilePath("docs",
-      "sql-error-conditions.md").toUri, StandardCharsets.UTF_8).split("\n")
-      .filter(_.startsWith("###")).map(s => s.replace("###", "").trim)
-      .filter(linkInDocRegex.findFirstMatchIn(_).isEmpty)
-
-    commonErrorsInDoc.foreach(s => assert(errors.contains(s),
-      s"Error class: $s is not in error-classes.json"))
-
-    val titlePrefix = "title:"
-    val errorsInDoc = errorDocPaths.map(lines => {
-      val errorClass = lines.filter(_.startsWith(titlePrefix))
-        .map(s => s.replace("error class", "").replace(titlePrefix, 
"").trim).head
-      assert(errors.contains(errorClass), s"Error class: $errorClass is not in 
error-classes.json")
-      val subClasses = lines.filter(_.startsWith("##")).map(s => 
s.replace("##", "").trim)
-        .map { s =>
-          assert(errors(errorClass).subClass.get.contains(s),
-            s"Error class: $errorClass does not contain sub class: $s in 
error-classes.json")
-          s
+    def quoteParameter(content: String): String = {
+      "(?<!MAP|STRUCT|ARRAY)<(.*?)>".r.replaceAllIn(content, (m: Regex.Match) 
=> {

Review Comment:
   @MaxGekk I updated the rule, fix all problems you metioned. Please check the 
rule is ok or not. Thanks.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to