Dmitry Lychagin has uploaded a new change for review. https://asterix-gerrit.ics.uci.edu/2571
Change subject: [ASTERIXDB-2356][SQL] Syntax error when parsing CASE expression ...................................................................... [ASTERIXDB-2356][SQL] Syntax error when parsing CASE expression - user model changes: no - storage format changes: no - interface changes: no Details: - Move CASE expression from Expression production to PrimaryExpr Change-Id: Ia9ded0d7a20aaa9cd81240821f5b903f262b0b6a --- A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_08/case_08.1.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_08/case_08.1.adm M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml M asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj 4 files changed, 31 insertions(+), 1 deletion(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/71/2571/1 diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_08/case_08.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_08/case_08.1.query.sqlpp new file mode 100644 index 0000000..60229d5 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_08/case_08.1.query.sqlpp @@ -0,0 +1,24 @@ +/* + * 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 + CASE WHEN get_year(current_date()) > 0 THEN "abc" ELSE "def" END LIKE "a%" as v1, + ( CASE WHEN get_year(current_date()) > 0 THEN "abc" ELSE "def" END ) LIKE "a%" as v2, + [ CASE WHEN get_year(current_date()) > 0 THEN "abc" ELSE "def" END LIKE "a%" ] as v3 + diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_08/case_08.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_08/case_08.1.adm new file mode 100644 index 0000000..8b095a8 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_08/case_08.1.adm @@ -0,0 +1 @@ +{ "v1": true, "v2": true, "v3": [ true ] } \ No newline at end of file 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 05382bc..b700df0 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml +++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml @@ -3599,6 +3599,11 @@ </compilation-unit> </test-case> <test-case FilePath="misc"> + <compilation-unit name="case_08"> + <output-dir compare="Text">case_08</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="misc"> <compilation-unit name="dataset_nodegroup"> <output-dir compare="Text">dataset_nodegroup</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 9af114b..e1f6f6a 100644 --- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj +++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj @@ -1789,7 +1789,6 @@ ( LOOKAHEAD(2) expr = OperatorExpr() - | expr = CaseExpr() | expr = QuantifiedExpression() ) { @@ -2305,6 +2304,7 @@ { ( LOOKAHEAD(4) expr = FunctionCallExpr() + | expr = CaseExpr() | expr = Literal() | expr = VariableRef() | expr = ListConstructor() -- To view, visit https://asterix-gerrit.ics.uci.edu/2571 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia9ded0d7a20aaa9cd81240821f5b903f262b0b6a Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Dmitry Lychagin <[email protected]>
