Skip to content

Commit

Permalink
[SPARK-2050][SQL] LIKE, RLIKE and IN in HQL should not be case sensit…
Browse files Browse the repository at this point in the history
…ive.

Author: Michael Armbrust <[email protected]>

Closes #989 from marmbrus/caseSensitiveFuncitons and squashes the following commits:

681de54 [Michael Armbrust] LIKE, RLIKE and IN in HQL should not be case sensitive.

(cherry picked from commit 41db44c)
Signed-off-by: Reynold Xin <[email protected]>
  • Loading branch information
marmbrus authored and rxin committed Jun 6, 2014
1 parent 16e3910 commit d3717be
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,10 @@ private[hive] object HiveQl {
val NOT = "(?i)NOT".r
val TRUE = "(?i)TRUE".r
val FALSE = "(?i)FALSE".r
val LIKE = "(?i)LIKE".r
val RLIKE = "(?i)RLIKE".r
val REGEXP = "(?i)REGEXP".r
val IN = "(?i)IN".r

protected def nodeToExpr(node: Node): Expression = node match {
/* Attribute References */
Expand Down Expand Up @@ -871,14 +875,14 @@ private[hive] object HiveQl {
case Token(">=", left :: right:: Nil) => GreaterThanOrEqual(nodeToExpr(left), nodeToExpr(right))
case Token("<", left :: right:: Nil) => LessThan(nodeToExpr(left), nodeToExpr(right))
case Token("<=", left :: right:: Nil) => LessThanOrEqual(nodeToExpr(left), nodeToExpr(right))
case Token("LIKE", left :: right:: Nil) => Like(nodeToExpr(left), nodeToExpr(right))
case Token("RLIKE", left :: right:: Nil) => RLike(nodeToExpr(left), nodeToExpr(right))
case Token("REGEXP", left :: right:: Nil) => RLike(nodeToExpr(left), nodeToExpr(right))
case Token(LIKE(), left :: right:: Nil) => Like(nodeToExpr(left), nodeToExpr(right))
case Token(RLIKE(), left :: right:: Nil) => RLike(nodeToExpr(left), nodeToExpr(right))
case Token(REGEXP(), left :: right:: Nil) => RLike(nodeToExpr(left), nodeToExpr(right))
case Token("TOK_FUNCTION", Token("TOK_ISNOTNULL", Nil) :: child :: Nil) =>
IsNotNull(nodeToExpr(child))
case Token("TOK_FUNCTION", Token("TOK_ISNULL", Nil) :: child :: Nil) =>
IsNull(nodeToExpr(child))
case Token("TOK_FUNCTION", Token("IN", Nil) :: value :: list) =>
case Token("TOK_FUNCTION", Token(IN(), Nil) :: value :: list) =>
In(nodeToExpr(value), list.map(nodeToExpr))
case Token("TOK_FUNCTION",
Token("between", Nil) ::
Expand Down

0 comments on commit d3717be

Please sign in to comment.