/** * Add any object of {@link PrimitiveType} or {@link Group} type with a String key. * @param key * @param object */ public void add(String key, Object object) { int fieldIndex = getIndex(key); if (object.getClass() == ParquetGroup.class) { this.addGroup(key, (Group) object); } else { this.add(fieldIndex, (Primitive) object); } }
public void add(int fieldIndex, int value) { this.add(fieldIndex, new IntegerValue(value)); }
@Override Object convertField(JsonElement value) { ParquetGroup mapGroup = new ParquetGroup((GroupType) schema()); JsonElementConverter converter = this.elementConverter; JsonObject map = (JsonObject) value; for (Map.Entry<String, JsonElement> entry : map.entrySet()) { ParquetGroup entrySet = (ParquetGroup) mapGroup.addGroup(MAP_KEY); entrySet.add(MAP_KEY_COLUMN_NAME, entry.getKey()); entrySet.add(MAP_VALUE_COLUMN_NAME, converter.convert(entry.getValue())); } return mapGroup; }
public void add(int fieldIndex, double value) { this.add(fieldIndex, new DoubleValue(value)); }
/** * Add any object of {@link PrimitiveType} or {@link Group} type with a String key. * @param key * @param object */ public void add(String key, Object object) { int fieldIndex = getIndex(key); if (object.getClass() == ParquetGroup.class) { this.addGroup(key, (Group) object); } else { this.add(fieldIndex, (Primitive) object); } }
public void add(int fieldIndex, NanoTime value) { this.add(fieldIndex, value.toInt96()); }
@Override Object convertField(JsonElement value) { ParquetGroup mapGroup = new ParquetGroup((GroupType) schema()); JsonElementConverter converter = this.elementConverter; JsonObject map = (JsonObject) value; for (Map.Entry<String, JsonElement> entry : map.entrySet()) { ParquetGroup entrySet = (ParquetGroup) mapGroup.addGroup(MAP_KEY); entrySet.add(MAP_KEY_COLUMN_NAME, entry.getKey()); entrySet.add(MAP_VALUE_COLUMN_NAME, converter.convert(entry.getValue())); } return mapGroup; }
public void add(int fieldIndex, float value) { this.add(fieldIndex, new FloatValue(value)); }
public void add(int fieldIndex, long value) { this.add(fieldIndex, new LongValue(value)); }
public void add(int fieldIndex, boolean value) { this.add(fieldIndex, new BooleanValue(value)); }
public void add(int fieldIndex, String value) { this.add(fieldIndex, new BinaryValue(Binary.fromString(value))); }
@Override Object convertField(JsonElement value) { ParquetGroup r1 = new ParquetGroup((GroupType) schema()); JsonObject inputRecord = value.getAsJsonObject(); for (Map.Entry<String, JsonElement> entry : inputRecord.entrySet()) { String key = entry.getKey(); JsonElementConverter converter = this.converters.get(key); Object convertedValue = converter.convert(entry.getValue()); boolean valueIsNull = convertedValue == null; Type.Repetition repetition = converter.jsonSchema.optionalOrRequired(); if (valueIsNull && repetition.equals(OPTIONAL)) { continue; } r1.add(key, convertedValue); } return r1; }
@Override Object convertField(JsonElement value) { ParquetGroup array = new ParquetGroup((GroupType) schema()); JsonElementConverter converter = this.elementConverter; for (JsonElement elem : (JsonArray) value) { array.add(ARRAY_KEY, converter.convert(elem)); } return array; }
public void add(int fieldIndex, Binary value) { switch (this.getType().getType(fieldIndex).asPrimitiveType().getPrimitiveTypeName()) { case BINARY: this.add(fieldIndex, new BinaryValue(value)); break; case INT96: this.add(fieldIndex, new Int96Value(value)); break; default: throw new UnsupportedOperationException( this.getType().asPrimitiveType().getName() + " not supported for Binary"); } }
public void add(int fieldIndex, int value) { this.add(fieldIndex, new IntegerValue(value)); }
public void add(int fieldIndex, long value) { this.add(fieldIndex, new LongValue(value)); }
public void add(int fieldIndex, float value) { this.add(fieldIndex, new FloatValue(value)); }
public void add(int fieldIndex, String value) { this.add(fieldIndex, new BinaryValue(Binary.fromString(value))); }
@Override Object convertField(JsonElement value) { ParquetGroup array = new ParquetGroup((GroupType) schema()); JsonElementConverter converter = this.elementConverter; for (JsonElement elem : (JsonArray) value) { array.add(ARRAY_KEY, converter.convert(elem)); } return array; }
public void add(int fieldIndex, Binary value) { switch (this.getType().getType(fieldIndex).asPrimitiveType().getPrimitiveTypeName()) { case BINARY: this.add(fieldIndex, new BinaryValue(value)); break; case INT96: this.add(fieldIndex, new Int96Value(value)); break; default: throw new UnsupportedOperationException( this.getType().asPrimitiveType().getName() + " not supported for Binary"); } }