This is an automated email from the ASF dual-hosted git repository.
peeyush pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new 84a0a83c86 [ASTERIXDB-3447][COMP] Syntax error on queries invovling *
in projection
84a0a83c86 is described below
commit 84a0a83c866a6f06b2e72183dfdf3ade930bc097
Author: Peeyush Gupta <[email protected]>
AuthorDate: Fri Jun 28 13:18:21 2024 -0700
[ASTERIXDB-3447][COMP] Syntax error on queries invovling * in projection
- user model changes: no
- storage format changes: no
- interface changes: no
Ext-ref: MB-62501
Change-Id: I14163054bd5e879c5663278109965eb3f590e752
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18405
Integration-Tests: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Reviewed-by: Ali Alsuliman <[email protected]>
---
.../select-star/var_star/var_star.5.query.sqlpp | 22 ++++++++++++++++++++++
.../select-star/var_star/var_star.6.query.sqlpp | 22 ++++++++++++++++++++++
.../results/select-star/var_star/var_star.5.adm | 3 +++
.../results/select-star/var_star/var_star.6.adm | 3 +++
.../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj | 12 +++++++-----
5 files changed, 57 insertions(+), 5 deletions(-)
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/select-star/var_star/var_star.5.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/select-star/var_star/var_star.5.query.sqlpp
new file mode 100644
index 0000000000..7a94768809
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/select-star/var_star/var_star.5.query.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+USE tpch;
+
+SELECT a.b.* from [{"b":1}, {"b":{"c":2}}, null] a
\ No newline at end of file
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/select-star/var_star/var_star.6.query.sqlpp
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/select-star/var_star/var_star.6.query.sqlpp
new file mode 100644
index 0000000000..da33d6dfa5
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/select-star/var_star/var_star.6.query.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+USE tpch;
+
+SELECT a.b.*, d.* from [{"b":1}, {"b":{"c":2}}, null] a, [{"b":1}] d;
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/select-star/var_star/var_star.5.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/select-star/var_star/var_star.5.adm
new file mode 100644
index 0000000000..6809f7274d
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/select-star/var_star/var_star.5.adm
@@ -0,0 +1,3 @@
+{ }
+{ "c": 2 }
+{ }
\ No newline at end of file
diff --git
a/asterixdb/asterix-app/src/test/resources/runtimets/results/select-star/var_star/var_star.6.adm
b/asterixdb/asterix-app/src/test/resources/runtimets/results/select-star/var_star/var_star.6.adm
new file mode 100644
index 0000000000..106bc7799a
--- /dev/null
+++
b/asterixdb/asterix-app/src/test/resources/runtimets/results/select-star/var_star/var_star.6.adm
@@ -0,0 +1,3 @@
+{ "b": 1 }
+{ "b": 1, "c": 2 }
+{ "b": 1 }
\ No newline at end of file
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index 2ec743d647..e65568e52d 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -4391,9 +4391,11 @@ Expression ValueExpr() throws ParseException:
{
expr = PrimaryExpr()
(
- accessor = FieldAccessor(accessor != null ? accessor : expr)
- |
- accessor = IndexAccessor(accessor != null ? accessor : expr)
+ LOOKAHEAD(2)(
+ accessor = FieldAccessor(accessor != null ? accessor : expr)
+ |
+ accessor = IndexAccessor(accessor != null ? accessor : expr)
+ )
)*
{
return accessor == null ? expr : accessor;
@@ -5335,8 +5337,8 @@ Projection Projection() throws ParseException :
{
(
<MUL> { kind = Projection.Kind.STAR; startSrcLoc =
getSourceLocation(token); }
- | LOOKAHEAD(3) expr = VariableRef() <DOT> <MUL> { kind =
Projection.Kind.VAR_STAR; }
- | expr = Expression()
+ | LOOKAHEAD(ValueExpr() <DOT> <MUL>) expr = ValueExpr() <DOT> <MUL> {
kind = Projection.Kind.VAR_STAR; }
+ | expr = Expression()
( // EXCLUDE is a soft-keyword-- we want to avoid mistaking EXCLUDE as
an identifier here.
LOOKAHEAD({ getToken(1).kind == AS || getToken(1).kind == QUOTED_STRING
|| (getToken(1).kind == IDENTIFIER && !laIdentifier(1,
EXCLUDE)) })