HyukjinKwon commented on a change in pull request #33627:
URL: https://github.com/apache/spark/pull/33627#discussion_r705827380
##########
File path: core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala
##########
@@ -73,7 +74,17 @@ class SparkThrowableSuite extends SparkFunSuite {
test("SQLSTATE invariants") {
val sqlStates = errorClassToInfoMap.values.toSeq.flatMap(_.sqlState)
- checkCondition(sqlStates, s => s.length == 5)
+ val errorClassReadMe =
Utils.getSparkClassLoader.getResource("error/README.md")
+ val errorClassReadMeContents =
IOUtils.toString(errorClassReadMe.openStream())
+ val sqlStateTableRegex =
+ "(?s)\\[//]: # \\(SQLSTATE table start\\)(.+)\\[//]: # \\(SQLSTATE table
end\\)".r
+ val sqlTable = sqlStateTableRegex.findFirstIn(errorClassReadMeContents).get
+ val sqlTableRows = sqlTable.split("\n").filter(_.startsWith("|")).drop(2)
+ val validSqlStates = sqlTableRows.map(_.slice(1, 6)).toSet
+ // Sanity check
+ assert(Set("07000", "42000", "HZ000").subsetOf(validSqlStates),
validSqlStates)
Review comment:
Sorry maybe I missed something. But is there an easy to upload all
existing error codes in Spark, and validate 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: [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]