karenfeng commented on a change in pull request #32850:
URL: https://github.com/apache/spark/pull/32850#discussion_r655597628
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala
##########
@@ -316,7 +316,8 @@ object QueryParsingErrors {
}
def duplicateKeysError(key: String, ctx: ParserRuleContext): Throwable = {
- new ParseException(s"Found duplicate keys '$key'.", ctx)
+ // Found duplicate keys '$key'
+ new ParseException(errorClass = "DUPLICATE_KEY_ERROR", messageParameters =
Seq(key), ctx)
Review comment:
From a Scala-focused developer perspective, I agree that objects are
easier to maintain. However, using string classes has a couple of benefits:
- The JSON file can be easily translated into a auto-generated documentation
page (without tricks like reflection)
- Other clients (eg. Python and R) can natively throw errors with error
classes, creating a single easily-auditable source of truth
What do you think? For a happy medium, we could auto-generate Scala from
JSON, but I think that may increase maintenance burden.
--
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]