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


##########
core/src/main/resources/error/error-classes.json:
##########
@@ -1009,6 +1009,11 @@
           "Initial bytes from input <saltedMagic> do not match 'Salted__' 
(0x53616C7465645F5F)."
         ]
       },
+      "NEGATIVE_REGEX_GROUP_INDEX" : {

Review Comment:
   Can't you re-use the existing error class `REGEX_GROUP_INDEX`?



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/regexpExpressions.scala:
##########
@@ -748,7 +748,7 @@ object RegExpReplace {
 object RegExpExtractBase {
   def checkGroupIndex(prettyName: String, groupCount: Int, groupIndex: Int): 
Unit = {
     if (groupIndex < 0) {
-      throw QueryExecutionErrors.regexGroupIndexLessThanZeroError
+      throw QueryExecutionErrors.regexGroupIndexLessThanZeroError(prettyName)
     } else if (groupCount < groupIndex) {
       throw QueryExecutionErrors.regexGroupIndexExceedGroupCountError(
         prettyName, groupCount, groupIndex)

Review Comment:
   How about:
   ```scala
       if (groupIndex < 0 || groupCount < groupIndex) {
         throw QueryExecutionErrors.invalidRegexGroupIndexError(
           prettyName, groupCount, groupIndex)
       }
   ```



-- 
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