dilipbiswal commented on a change in pull request #27477:
URL: https://github.com/apache/spark/pull/27477#discussion_r413179599
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -1403,14 +1411,21 @@ class AstBuilder(conf: SQLConf) extends
SqlBaseBaseVisitor[AnyRef] with Logging
case SqlBaseParser.IN =>
invertIfNotDefined(In(e, ctx.expression.asScala.map(expression)))
case SqlBaseParser.LIKE =>
- val escapeChar = Option(ctx.escapeChar).map(string).map { str =>
- if (str.length != 1) {
- throw new ParseException("Invalid escape string." +
- "Escape string must contains only one character.", ctx)
- }
- str.charAt(0)
- }.getOrElse('\\')
- invertIfNotDefined(Like(e, expression(ctx.pattern), escapeChar))
+ Option(ctx.quantifier).map(_.getType) match {
+ case Some(SqlBaseParser.ANY) =>
+ getLikeQuantifierExps(ctx.expression).reduceLeft(Or)
+ case Some(SqlBaseParser.ALL) =>
+ getLikeQuantifierExps(ctx.expression).reduceLeft(And)
Review comment:
Nit: getLikeQuantifierExps -> getLikeQuantifierExprs ?
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -1403,14 +1411,21 @@ class AstBuilder(conf: SQLConf) extends
SqlBaseBaseVisitor[AnyRef] with Logging
case SqlBaseParser.IN =>
invertIfNotDefined(In(e, ctx.expression.asScala.map(expression)))
case SqlBaseParser.LIKE =>
- val escapeChar = Option(ctx.escapeChar).map(string).map { str =>
- if (str.length != 1) {
- throw new ParseException("Invalid escape string." +
- "Escape string must contains only one character.", ctx)
- }
- str.charAt(0)
- }.getOrElse('\\')
- invertIfNotDefined(Like(e, expression(ctx.pattern), escapeChar))
+ Option(ctx.quantifier).map(_.getType) match {
+ case Some(SqlBaseParser.ANY) =>
+ getLikeQuantifierExps(ctx.expression).reduceLeft(Or)
+ case Some(SqlBaseParser.ALL) =>
+ getLikeQuantifierExps(ctx.expression).reduceLeft(And)
+ case _ =>
+ val escapeChar = Option(ctx.escapeChar).map(string).map { str =>
+ if (str.length != 1) {
+ throw new ParseException("Invalid escape string." +
+ "Escape string must contains only one character.", ctx)
Review comment:
Nit: contains -> contain ?
----------------------------------------------------------------
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]