Skip to content

Commit

Permalink
Supported 'not like' syntax in sql
Browse files Browse the repository at this point in the history
  • Loading branch information
ravipesala committed Nov 3, 2014
1 parent 76386e1 commit 35c11e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ class SqlParser extends AbstractSparkSQLParser {
| termExpression ~ (RLIKE ~> termExpression) ^^ { case e1 ~ e2 => RLike(e1, e2) }
| termExpression ~ (REGEXP ~> termExpression) ^^ { case e1 ~ e2 => RLike(e1, e2) }
| termExpression ~ (LIKE ~> termExpression) ^^ { case e1 ~ e2 => Like(e1, e2) }
| termExpression ~ (NOT ~ LIKE ~> termExpression) ^^ { case e1 ~ e2 => Not(Like(e1, e2)) }
| termExpression ~ (IN ~ "(" ~> rep1sep(termExpression, ",")) <~ ")" ^^ {
case e1 ~ e2 => In(e1, e2)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,4 +938,9 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {
checkAnswer(sql("SELECT key FROM testData WHERE key not between 0 and 10 order by key"),
(11 to 100).map(i => Seq(i)))
}

test("SPARK-4207 Query which has syntax like 'not like' is not working in Spark SQL") {
checkAnswer(sql("SELECT key FROM testData WHERE value not like '100%' order by key"),
(1 to 99).map(i => Seq(i)))
}
}

0 comments on commit 35c11e7

Please sign in to comment.