>From Peeyush Gupta <[email protected]>: Peeyush Gupta has submitted this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18405 )
Change subject: [ASTERIXDB-3447][COMP] Syntax error on queries invovling * in projection ...................................................................... [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]> --- A asterixdb/asterix-app/src/test/resources/runtimets/results/select-star/var_star/var_star.5.adm A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/select-star/var_star/var_star.6.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/select-star/var_star/var_star.5.query.sqlpp M asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj A asterixdb/asterix-app/src/test/resources/runtimets/results/select-star/var_star/var_star.6.adm 5 files changed, 75 insertions(+), 5 deletions(-) Approvals: Ali Alsuliman: Looks good to me, approved Jenkins: Verified; Verified 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 0000000..7a94768 --- /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 0000000..da33d6d --- /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 0000000..6809f72 --- /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 0000000..106bc77 --- /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 2ec743d..e65568e 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 @@ { 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 @@ { ( <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)) }) -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18405 To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Change-Id: I14163054bd5e879c5663278109965eb3f590e752 Gerrit-Change-Number: 18405 Gerrit-PatchSet: 6 Gerrit-Owner: Peeyush Gupta <[email protected]> Gerrit-Reviewer: Ali Alsuliman <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Glenn Galvizo <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Peeyush Gupta <[email protected]> Gerrit-MessageType: merged
