public static List<InputRow> parseGenericRecord( GenericRecord record, MapInputRowParser mapParser, ObjectFlattener<GenericRecord> avroFlattener ) { return mapParser.parseBatch(avroFlattener.flatten(record)); } }
@Override public List<InputRow> parseBatch(Group group) { return parser.parseBatch(groupFlattener.flatten(group)); } }
@Nullable private InputRow parseMap(@Nullable Map<String, Object> theMap) { // If a header is present in the data (and with proper configurations), a null is returned if (theMap == null) { return null; } return Iterators.getOnlyElement(mapParser.parseBatch(theMap).iterator()); } }
public static List<InputRow> inputRowsWithDimensions(final List<String> dimensions) { final MapInputRowParser parser = new MapInputRowParser( new TimeAndDimsParseSpec( new TimestampSpec(TIMESTAMP_COLUMN, "iso", null), new DimensionsSpec( DimensionsSpec.getDefaultSchemas(dimensions), dimensions.isEmpty() ? ImmutableList.of("t", "c1", "c2") : null, null ) ) ); return ImmutableList.of( parser.parseBatch(ImmutableMap.of("t", "2000-01-01", "c1", "9", "c2", ImmutableList.of("a"))).get(0), parser.parseBatch(ImmutableMap.of("t", "2000-01-02", "c1", "10.1", "c2", ImmutableList.of())).get(0), parser.parseBatch(ImmutableMap.of("t", "2000-01-03", "c1", "2", "c2", ImmutableList.of(""))).get(0), parser.parseBatch(ImmutableMap.of("t", "2001-01-01", "c1", "1", "c2", ImmutableList.of("a", "c"))).get(0), parser.parseBatch(ImmutableMap.of("t", "2001-01-02", "c1", "4", "c2", ImmutableList.of("abc"))).get(0), parser.parseBatch(ImmutableMap.of("t", "2001-01-03", "c1", "5")).get(0) ); }
InputRowParser.class ); final InputRow parsed = parser2.parseBatch( ImmutableMap.of( "foo", "x",
InputRowParser.class ); final InputRow parsed = parser2.parseBatch( ImmutableMap.of( "timemillis", 1412705931123L,
@Nullable private InputRow parseMap(@Nullable Map<String, Object> theMap) { // If a header is present in the data (and with proper configurations), a null is returned if (theMap == null) { return null; } return Iterators.getOnlyElement(mapParser.parseBatch(theMap).iterator()); } }
public static List<InputRow> parseGenericRecord( GenericRecord record, ParseSpec parseSpec, ObjectFlattener<GenericRecord> avroFlattener ) { return new MapInputRowParser(parseSpec).parseBatch(avroFlattener.flatten(record)); } }