You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2023/06/14 01:18:46 UTC
[asterixdb] 09/14: [ASTERIXDB-3156][API] Allow specifying lossless-adm as format
This is an automated email from the ASF dual-hosted git repository.
mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit 5b13c7979d9b38793fe9e08a7e59a65f57fe147b
Author: Murtadha Hubail <mu...@couchbase.com>
AuthorDate: Tue Mar 28 00:35:42 2023 +0300
[ASTERIXDB-3156][API] Allow specifying lossless-adm as format
- user model changes: yes
- storage format changes: no
- interface changes: no
Details:
- Allow specifying `lossless-adm` as format in the
REST API.
- Add test case.
Change-Id: I24057c56bafbe021b5d4da93a82cdaa0213bccd5
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17451
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <al...@gmail.com>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
(cherry picked from commit ffdcf57835a49b049fd65a840469468bc7274fa1)
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17564
---
.../http/server/QueryServiceRequestParameters.java | 2 ++
.../request-param/request-param.003.query.sqlpp | 24 ++++++++++++++++++++++
.../api/request-param/request-param.003.adm | 2 ++
3 files changed, 28 insertions(+)
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceRequestParameters.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceRequestParameters.java
index df068c0824..b6913e448b 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceRequestParameters.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/server/QueryServiceRequestParameters.java
@@ -626,6 +626,8 @@ public class QueryServiceRequestParameters {
return Pair.of(OutputFormat.CLEAN_JSON, Boolean.FALSE);
} else if (value.equals(HttpUtil.ContentType.ADM)) {
return Pair.of(OutputFormat.ADM, Boolean.FALSE);
+ } else if (value.equals(Attribute.LOSSLESS_ADM.str())) {
+ return Pair.of(OutputFormat.LOSSLESS_ADM_JSON, Boolean.FALSE);
} else {
throw new RuntimeDataException(ErrorCode.INVALID_REQ_PARAM_VAL, parameterName, value);
}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/api/request-param/request-param.003.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/api/request-param/request-param.003.query.sqlpp
new file mode 100644
index 0000000000..52800c8708
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/api/request-param/request-param.003.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.
+ */
+
+// requesttype=application/json
+// param format:string=lossless-adm
+
+from [1, 2] as v
+select v;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/request-param/request-param.003.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/request-param/request-param.003.adm
new file mode 100644
index 0000000000..cb88308596
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/request-param/request-param.003.adm
@@ -0,0 +1,2 @@
+{ "v": 1 }
+{ "v": 2 }
\ No newline at end of file