[email protected] has uploaded a new change for review. https://asterix-gerrit.ics.uci.edu/3078
Change subject: more tests. ...................................................................... more tests. Change-Id: Ib516194899902ed97091a5d59d5c47ffafc7c270 --- A asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.3.parse.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.4.parse.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.5.parse.sqlpp M asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.1.adm M asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.2.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.3.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.4.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.5.adm M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/parser/ParseOnlyResult.java 9 files changed, 99 insertions(+), 4 deletions(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/78/3078/1 diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.3.parse.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.3.parse.sqlpp new file mode 100644 index 0000000..cb60e4b --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.3.parse.sqlpp @@ -0,0 +1,30 @@ +/* + * 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. + */ + +/* + * Description : Test named statement parameters with json encoded request + * Expected Res : Success + * Date : Jun 2018 + */ + +-- param parse-only:string=true + + +SELECT VALUE bw FROM breweries bw WHERE bw.name = $name + diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.4.parse.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.4.parse.sqlpp new file mode 100644 index 0000000..605bff8 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.4.parse.sqlpp @@ -0,0 +1,31 @@ +/* + * 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. + */ + +/* + * Description : Test named statement parameters with json encoded request + * Expected Res : Success + * Date : Jun 2018 + */ + +-- param parse-only:string=true + +// param $p_int:json=42 +// param $p_str:json="hello" + +select $p_int, $p_str diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.5.parse.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.5.parse.sqlpp new file mode 100644 index 0000000..df5b4a9 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/parseonly/001/named_01.5.parse.sqlpp @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* + * Description : Test named statement parameters with json encoded request + * Expected Res : Success + * Date : Jun 2018 + */ + +-- param parse-only:string=true + +// requesttype=application/json + +// param $p_int:json=42 + +select value $p_int diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.1.adm index 66f16df..b2feb0f 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.1.adm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.1.adm @@ -1 +1 @@ -{"statement-parameters":"[?qname,]"} +{"statement-parameters":"[?qname]"} diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.2.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.2.adm index f38b229..35bdcab 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.2.adm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.2.adm @@ -1 +1 @@ -{"statement-parameters":"[?p_obj,?p_null,?p_bool,?p_dbl,?p_int,?p_str,?p_arr,?p_dec,]"} +{"statement-parameters":"[?p_obj,?p_null,?p_bool,?p_dbl,?p_int,?p_str,?p_arr,?p_dec]"} diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.3.adm new file mode 100644 index 0000000..c2e13fd --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.3.adm @@ -0,0 +1 @@ +{"statement-parameters":"[?name]"} diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.4.adm new file mode 100644 index 0000000..0f45860 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.4.adm @@ -0,0 +1 @@ +{"statement-parameters":"[?p_int,?p_str]"} diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.5.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.5.adm new file mode 100644 index 0000000..818e48c --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/parseonly/001/named_01.5.adm @@ -0,0 +1 @@ +{"statement-parameters":"[?p_int]"} diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/parser/ParseOnlyResult.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/parser/ParseOnlyResult.java index 6b356d6..ff584d1 100644 --- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/parser/ParseOnlyResult.java +++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/parser/ParseOnlyResult.java @@ -42,8 +42,7 @@ for (VariableExpr extVarRef : externalVariables) { extVarsSerialized += SqlppVariableUtil.toUserDefinedName(extVarRef.getVar().getValue()) + ","; } - extVarsSerialized += "]"; - + extVarsSerialized = extVarsSerialized.replaceAll(",$","]"); return extVarsSerialized; } -- To view, visit https://asterix-gerrit.ics.uci.edu/3078 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib516194899902ed97091a5d59d5c47ffafc7c270 Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: [email protected]
