ulysses-you commented on a change in pull request #26860: [SPARK-30230][SQL]
Like ESCAPE syntax can not use '_' and '%'
URL: https://github.com/apache/spark/pull/26860#discussion_r357020145
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -1393,6 +1393,10 @@ class AstBuilder(conf: SQLConf) extends
SqlBaseBaseVisitor[AnyRef] with Logging
}
str.charAt(0)
}.getOrElse('\\')
+ if (Set('%', '_').contains(escapeChar)) {
+ throw new ParseException("Invalid escape string." +
+ "Escape string can not be '%', '_'.", ctx)
+ }
Review comment:
You mean like this ?
```
ESCAPE_STRING
: '\'' ( ~('\''|'\\') | ('\\' .) | ~('%' | '_') )* '\''
| '\'' ( ~('\''|'\\') | ('\\' .) | ~('%' | '_') )* '\''
;
NOT? kind=LIKE pattern=valueExpression (ESCAPE escapeChar=ESCAPE_STRING)?
```
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]