maropu commented on a change in pull request #29200:
URL: https://github.com/apache/spark/pull/29200#discussion_r459253430
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/SQLKeywordSuite.scala
##########
@@ -146,11 +159,32 @@ class SQLKeywordSuite extends SparkFunSuite with
SQLKeywordUtils {
}
}
- test("Spark keywords are documented correctly") {
- val reservedKeywordsInDoc = keywordsInDoc.filter(_.apply(1) ==
"reserved").map(_.head).toSet
- if (reservedKeywordsInAnsiMode != reservedKeywordsInDoc) {
- val misImplemented = (reservedKeywordsInDoc --
reservedKeywordsInAnsiMode).toSeq.sorted
- fail("Some keywords are documented as reserved but actually not: " +
+ test("Spark keywords are documented correctly under ansi mode") {
+ // keywords under ANSI mode should either be reserved or non-reserved.
+ keywordsInDoc.map(_.apply(1)).foreach { desc =>
+ assert(desc == "reserved" || desc == "non-reserved")
+ }
+
+ val nonReservedInDoc = keywordsInDoc.filter(_.apply(1) ==
"non-reserved").map(_.head).toSet
+ if (nonReservedKeywordsInAnsiMode != nonReservedInDoc) {
+ val misImplemented = ((nonReservedInDoc --
nonReservedKeywordsInAnsiMode) ++
+ (nonReservedKeywordsInAnsiMode -- nonReservedInDoc)).toSeq.sorted
+ fail("Some keywords are documented and implemented inconsistently: " +
+ misImplemented.mkString(", "))
+ }
+ }
+
+ test("Spark keywords are documented correctly under default mode") {
Review comment:
Oh, looks nice!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]