revert removing 'not in' clause.
Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/a7ed4e8c Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/a7ed4e8c Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/a7ed4e8c Branch: refs/heads/master Commit: a7ed4e8c56d6ba9f629466f4c2128834881f7f6a Parents: 428c453 Author: DO YUNG YOON <[email protected]> Authored: Mon Jun 18 12:38:03 2018 +0900 Committer: DO YUNG YOON <[email protected]> Committed: Mon Jun 18 12:38:03 2018 +0900 ---------------------------------------------------------------------- .../org/apache/s2graph/core/parsers/WhereParser.scala | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a7ed4e8c/s2core/src/main/scala/org/apache/s2graph/core/parsers/WhereParser.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/parsers/WhereParser.scala b/s2core/src/main/scala/org/apache/s2graph/core/parsers/WhereParser.scala index a212dbc..4b9725e 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/parsers/WhereParser.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/parsers/WhereParser.scala @@ -190,8 +190,10 @@ case class WhereParser() extends JavaTokenParsers { val in = "in|IN".r - val contains = "contains|CONTAINS".r + val notIn = "not in|NOT IN".r + val contains = "contains|CONTAINS".r + def where: Parser[Where] = rep(clause) ^^ (Where(_)) def paren: Parser[Clause] = "(" ~> clause <~ ")" @@ -221,10 +223,14 @@ case class WhereParser() extends JavaTokenParsers { case f ~ minV ~ maxV => Between(f, minV, maxV) } - val _in = identWithDot ~ in ~ ("(" ~> repsep(stringLiteral, ",") <~ ")") ^^ { + val _in = identWithDot ~ (notIn | in) ~ ("(" ~> repsep(stringLiteral, ",") <~ ")") ^^ { case f ~ op ~ values => - if (f.startsWith("_parent")) IN(f, values.toSet) - else InWithoutParent(f, values.toSet) + val inClause = + if (f.startsWith("_parent")) IN(f, values.toSet) + else InWithoutParent(f, values.toSet) + + if (op.toLowerCase == "in") inClause + else Not(inClause) } val _contains = identWithDot ~ contains ~ stringLiteral ^^ {
