private static void setList(JSONWriter writer, ListColumnVector vector, TypeDescription schema, int row) throws JSONException { writer.array(); int offset = (int) vector.offsets[row]; TypeDescription childType = schema.getChildren().get(0); for (int i = 0; i < vector.lengths[row]; ++i) { setValue(writer, vector.child, childType, offset + i); } writer.endArray(); }
static void printBinary(JSONWriter writer, BytesColumnVector vector, int row) throws JSONException { writer.array(); int offset = vector.start[row]; for(int i=0; i < vector.length[row]; ++i) { writer.value(0xff & (int) vector.vector[row][offset + i]); } writer.endArray(); } static void printValue(JSONWriter writer, ColumnVector vector,
private static void printList(JSONWriter writer, ListColumnVector vector, TypeDescription schema, int row) throws JSONException { writer.array(); int offset = (int) vector.offsets[row]; TypeDescription childType = schema.getChildren().get(0); for (int i = 0; i < vector.lengths[row]; ++i) { printValue(writer, vector.child, childType, offset + i); } writer.endArray(); }
private static void printList(JSONWriter writer, List<Object> obj, List<OrcProto.Type> types, OrcProto.Type type ) throws IOException, JSONException { int subtype = type.getSubtypes(0); writer.array(); for(Object item: obj) { printObject(writer, item, types, subtype); } writer.endArray(); }
private static void printMap(JSONWriter writer, Map<Object, Object> obj, List<OrcProto.Type> types, OrcProto.Type type ) throws IOException, JSONException { writer.array(); int keyType = type.getSubtypes(0); int valueType = type.getSubtypes(1); for(Map.Entry<Object,Object> item: obj.entrySet()) { writer.object(); writer.key("_key"); printObject(writer, item.getKey(), types, keyType); writer.key("_value"); printObject(writer, item.getValue(), types, valueType); writer.endObject(); } writer.endArray(); }
private static void printMap(JSONWriter writer, MapColumnVector vector, TypeDescription schema, int row) throws JSONException { writer.array(); TypeDescription keyType = schema.getChildren().get(0); TypeDescription valueType = schema.getChildren().get(1); int offset = (int) vector.offsets[row]; for (int i = 0; i < vector.lengths[row]; ++i) { writer.object(); writer.key("_key"); printValue(writer, vector.keys, keyType, offset + i); writer.key("_value"); printValue(writer, vector.values, valueType, offset + i); writer.endObject(); } writer.endArray(); }
private static void writeRowGroupIndexes(JSONWriter writer, int col, OrcProto.RowIndex[] rowGroupIndex) throws JSONException { OrcProto.RowIndex index; if (rowGroupIndex == null || (col >= rowGroupIndex.length) || ((index = rowGroupIndex[col]) == null)) { return; } writer.key("rowGroupIndexes").array(); for (int entryIx = 0; entryIx < index.getEntryCount(); ++entryIx) { writer.object(); writer.key("entryId").value(entryIx); OrcProto.RowIndexEntry entry = index.getEntry(entryIx); if (entry == null) { continue; } OrcProto.ColumnStatistics colStats = entry.getStatistics(); writeColumnStatistics(writer, ColumnStatisticsImpl.deserialize(colStats)); writer.key("positions").array(); for (int posIx = 0; posIx < entry.getPositionsCount(); ++posIx) { writer.value(entry.getPositions(posIx)); } writer.endArray(); writer.endObject(); } writer.endArray(); }
private static void writeBloomFilterIndexes(JSONWriter writer, int col, OrcProto.BloomFilterIndex[] bloomFilterIndex) throws JSONException { BloomFilterIO stripeLevelBF = null; if (bloomFilterIndex != null && bloomFilterIndex[col] != null) { int entryIx = 0; writer.key("bloomFilterIndexes").array(); for (OrcProto.BloomFilter bf : bloomFilterIndex[col].getBloomFilterList()) { writer.object(); writer.key("entryId").value(entryIx++); BloomFilterIO toMerge = new BloomFilterIO(bf); writeBloomFilterStats(writer, toMerge); if (stripeLevelBF == null) { stripeLevelBF = toMerge; } else { stripeLevelBF.merge(toMerge); } writer.endObject(); } writer.endArray(); } if (stripeLevelBF != null) { writer.key("stripeLevelBloomFilter"); writer.object(); writeBloomFilterStats(writer, stripeLevelBF); writer.endObject(); } }
writer.key("schema").array(); writeSchema(writer, reader.getTypes()); writer.endArray(); writer.key("stripeStatistics").array(); List<StripeStatistics> stripeStatistics = reader.getStripeStatistics(); for (int n = 0; n < stripeStatistics.size(); n++) { writer.key("stripeNumber").value(n + 1); StripeStatistics ss = stripeStatistics.get(n); writer.key("columnStatistics").array(); for (int i = 0; i < ss.getColumnStatistics().length; i++) { writer.object(); writer.key("fileStatistics").array(); for (int i = 0; i < stats.length; ++i) { writer.object(); writer.key("stripes").array(); int stripeIx = -1; for (StripeInformation stripe : reader.getStripes()) { writer.key("streams").array(); for (OrcProto.Stream section : footer.getStreamsList()) { writer.object(); writer.key("encodings").array(); for (int i = 0; i < footer.getColumnsCount(); ++i) { writer.object();