Repository: asterixdb Updated Branches: refs/heads/master 8c3da6fb6 -> 4a4b896d3
Add <> as a synonym to !=. Change-Id: I3c670cf3d0e53725dce8ef2acb33970f8030a0a8 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1180 Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Till Westmann <ti...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/4a4b896d Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/4a4b896d Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/4a4b896d Branch: refs/heads/master Commit: 4a4b896d3baa2a474454fe691df3382e94c0633b Parents: 8c3da6f Author: Yingyi Bu <yin...@couchbase.com> Authored: Fri Sep 16 12:09:11 2016 -0700 Committer: Yingyi Bu <buyin...@gmail.com> Committed: Fri Sep 16 14:33:40 2016 -0700 ---------------------------------------------------------------------- .../comparison/neq_02/neq_02.3.query.sqlpp | 23 ++++++++++++++++++++ .../resources/runtimets/testsuite_sqlpp.xml | 5 +++++ .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj | 8 +++++-- 3 files changed, 34 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4a4b896d/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/neq_02/neq_02.3.query.sqlpp ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/neq_02/neq_02.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/neq_02/neq_02.3.query.sqlpp new file mode 100644 index 0000000..8a6cf27 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/comparison/neq_02/neq_02.3.query.sqlpp @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +select element x +from [1,2,2] as x +where x <> 2 +; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4a4b896d/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml index 932a602..54f06e6 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml +++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml @@ -1077,6 +1077,11 @@ <output-dir compare="Text">neq_01</output-dir> </compilation-unit> </test-case> + <test-case FilePath="comparison"> + <compilation-unit name="neq_02"> + <output-dir compare="Text">neq_01</output-dir> + </compilation-unit> + </test-case> <!-- <test-case FilePath="comparison"> <compilation-unit name="numeric-comparison_01"> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4a4b896d/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj index f9ce037..9cabf84 100644 --- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj +++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj @@ -1761,7 +1761,7 @@ Expression RelExpr()throws ParseException: } ( - LOOKAHEAD(2)( <LT> | <GT> | <LE> | <GE> | <EQ> | <NE> |<SIMILAR> | (<NOT> { not = true; })? (<LIKE>|<IN>)) + LOOKAHEAD(2)( <LT> | <GT> | <LE> | <GE> | <EQ> | <NE> | <LG> |<SIMILAR> | (<NOT> { not = true; })? (<LIKE>|<IN>)) { String mhint = getHint(token); if (mhint != null) { @@ -1772,7 +1772,10 @@ Expression RelExpr()throws ParseException: } } String operator = token.image.toLowerCase(); - if(not){ + if (operator.equals("<>")){ + operator = "!="; + } + if (not) { operator = "not_" + operator; } if (op == null) { @@ -3130,6 +3133,7 @@ TOKEN : | <GE : ">="> | <EQ : "="> | <NE : "!="> + | <LG : "<>"> | <SIMILAR : "~="> }