Add ANY as a synonym to SOME for existential quantifiers.
Change-Id: I306a313a0785554eda79182efd8382a3d2697d2f
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1173
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/anysat_01/anysat_01.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/anysat_01/anysat_01.1.query.sqlpp
new file mode 100644
index 0000000..23ed7da
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/quantifiers/anysat_01/anysat_01.1.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 [10,-30,-21,50] as x
+where any y in [-20,-40] satisfies y > x
+;
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 3dd4ad5..932a602 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -4668,6 +4668,11 @@
</test-group>
<test-group name="quantifiers">
<test-case FilePath="quantifiers">
+ <compilation-unit name="anysat_01">
+ <output-dir compare="Text">somesat_01</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="quantifiers">
<compilation-unit name="everysat_01">
<output-dir compare="Text">everysat_01</output-dir>
</compilation-unit>
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index 19e856f..f9ce037 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -2911,7 +2911,7 @@
createNewScope();
}
- ( (<SOME> { qc.setQuantifier(QuantifiedExpression.Quantifier.SOME); })
+ ( ((<ANY>|<SOME>) { qc.setQuantifier(QuantifiedExpression.Quantifier.SOME); })
| (<EVERY> { qc.setQuantifier(QuantifiedExpression.Quantifier.EVERY); }))
var = Variable() <IN> inExpr = Expression()
{
@@ -2993,6 +2993,7 @@
{
<ALL : "all">
| <AND : "and">
+ | <ANY : "any">
| <APPLY : "apply">
| <AS : "as">
| <ASC : "asc">