[NO ISSUE][FUN] Make Dump_Index Function Return An Array of Values
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Make dump_index return a record that has an array of
values rather than a record listing each field.
- Adapt test case.
Change-Id: Iffdd0c1ad490952eb9bebdd0ac5015deddb3be42
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3332
Reviewed-by: Till Westmann <tillw@apache.org>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/DumpIndexReader.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/DumpIndexReader.java
index a3ba10c..2a22ac6 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/DumpIndexReader.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/DumpIndexReader.java
@@ -95,14 +95,13 @@
private void buildJsonRecord(ITupleReference tuple) throws HyracksDataException {
recordBuilder.setLength(0);
- recordBuilder.append("{");
+ recordBuilder.append("{\"values\":[");
for (int j = 0; j < tuple.getFieldCount(); ++j) {
- recordBuilder.append("\"field-").append(j + 1).append("\":");
bbis.setByteBuffer(ByteBuffer.wrap(tuple.getFieldData(j)), tuple.getFieldStart(j));
recordBuilder.append(secondaryRecDesc.getFields()[j].deserialize(dis));
recordBuilder.append(",");
}
recordBuilder.deleteCharAt(recordBuilder.length() - 1);
- recordBuilder.append("}");
+ recordBuilder.append("]}");
}
}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/dump_index/dump_index.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/dump_index/dump_index.3.adm
index b665a33..715896c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/dump_index/dump_index.3.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/dump_index/dump_index.3.adm
@@ -1 +1 @@
-[ { "field-1": "name1", "field-2": 1 }, { "field-1": "name2", "field-2": 2 } ]
\ No newline at end of file
+[ { "values": [ "name1", 1 ] }, { "values": [ "name2", 2 ] } ]
\ No newline at end of file