[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 <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
(cherry picked from commit ffdcf57835a49b049fd65a840469468bc7274fa1)
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17564
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 df068c0..b6913e4 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 @@
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 0000000..52800c8
--- /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 0000000..cb88308
--- /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