Skip to content

Commit 41db44c

Browse files
marmbrusrxin
authored andcommitted
[SPARK-2050][SQL] LIKE, RLIKE and IN in HQL should not be case sensitive.
Author: Michael Armbrust <[email protected]> Closes apache#989 from marmbrus/caseSensitiveFuncitons and squashes the following commits: 681de54 [Michael Armbrust] LIKE, RLIKE and IN in HQL should not be case sensitive.
1 parent b45c13e commit 41db44c

File tree

1 file changed

+8
-4
lines changed
  • sql/hive/src/main/scala/org/apache/spark/sql/hive

1 file changed

+8
-4
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,10 @@ private[hive] object HiveQl {
791791
val NOT = "(?i)NOT".r
792792
val TRUE = "(?i)TRUE".r
793793
val FALSE = "(?i)FALSE".r
794+
val LIKE = "(?i)LIKE".r
795+
val RLIKE = "(?i)RLIKE".r
796+
val REGEXP = "(?i)REGEXP".r
797+
val IN = "(?i)IN".r
794798

795799
protected def nodeToExpr(node: Node): Expression = node match {
796800
/* Attribute References */
@@ -871,14 +875,14 @@ private[hive] object HiveQl {
871875
case Token(">=", left :: right:: Nil) => GreaterThanOrEqual(nodeToExpr(left), nodeToExpr(right))
872876
case Token("<", left :: right:: Nil) => LessThan(nodeToExpr(left), nodeToExpr(right))
873877
case Token("<=", left :: right:: Nil) => LessThanOrEqual(nodeToExpr(left), nodeToExpr(right))
874-
case Token("LIKE", left :: right:: Nil) => Like(nodeToExpr(left), nodeToExpr(right))
875-
case Token("RLIKE", left :: right:: Nil) => RLike(nodeToExpr(left), nodeToExpr(right))
876-
case Token("REGEXP", left :: right:: Nil) => RLike(nodeToExpr(left), nodeToExpr(right))
878+
case Token(LIKE(), left :: right:: Nil) => Like(nodeToExpr(left), nodeToExpr(right))
879+
case Token(RLIKE(), left :: right:: Nil) => RLike(nodeToExpr(left), nodeToExpr(right))
880+
case Token(REGEXP(), left :: right:: Nil) => RLike(nodeToExpr(left), nodeToExpr(right))
877881
case Token("TOK_FUNCTION", Token("TOK_ISNOTNULL", Nil) :: child :: Nil) =>
878882
IsNotNull(nodeToExpr(child))
879883
case Token("TOK_FUNCTION", Token("TOK_ISNULL", Nil) :: child :: Nil) =>
880884
IsNull(nodeToExpr(child))
881-
case Token("TOK_FUNCTION", Token("IN", Nil) :: value :: list) =>
885+
case Token("TOK_FUNCTION", Token(IN(), Nil) :: value :: list) =>
882886
In(nodeToExpr(value), list.map(nodeToExpr))
883887
case Token("TOK_FUNCTION",
884888
Token("between", Nil) ::

0 commit comments

Comments
 (0)