Search in sources :

Example 1 with GenericRecordAsMap

use of io.druid.data.input.avro.GenericRecordAsMap in project druid by druid-io.

the class AvroStreamInputRowParser method parseGenericRecord.

protected static InputRow parseGenericRecord(GenericRecord record, ParseSpec parseSpec, List<String> dimensions, boolean fromPigAvroStorage, boolean binaryAsString) {
    GenericRecordAsMap genericRecordAsMap = new GenericRecordAsMap(record, fromPigAvroStorage, binaryAsString);
    TimestampSpec timestampSpec = parseSpec.getTimestampSpec();
    DateTime dateTime = timestampSpec.extractTimestamp(genericRecordAsMap);
    return new MapBasedInputRow(dateTime, dimensions, genericRecordAsMap);
}
Also used : GenericRecordAsMap(io.druid.data.input.avro.GenericRecordAsMap) TimestampSpec(io.druid.data.input.impl.TimestampSpec) DateTime(org.joda.time.DateTime)

Example 2 with GenericRecordAsMap

use of io.druid.data.input.avro.GenericRecordAsMap in project druid by druid-io.

the class ParquetHadoopInputRowParser method parse.

/**
   * imitate avro extension {@link AvroStreamInputRowParser#parseGenericRecord(GenericRecord, ParseSpec, List, boolean, boolean)}
   */
@Override
public InputRow parse(GenericRecord record) {
    GenericRecordAsMap genericRecordAsMap = new GenericRecordAsMap(record, false, binaryAsString);
    TimestampSpec timestampSpec = parseSpec.getTimestampSpec();
    DateTime dateTime = timestampSpec.extractTimestamp(genericRecordAsMap);
    return new MapBasedInputRow(dateTime, dimensions, genericRecordAsMap);
}
Also used : GenericRecordAsMap(io.druid.data.input.avro.GenericRecordAsMap) TimestampSpec(io.druid.data.input.impl.TimestampSpec) MapBasedInputRow(io.druid.data.input.MapBasedInputRow) DateTime(org.joda.time.DateTime)

Aggregations

GenericRecordAsMap (io.druid.data.input.avro.GenericRecordAsMap)2 TimestampSpec (io.druid.data.input.impl.TimestampSpec)2 DateTime (org.joda.time.DateTime)2 MapBasedInputRow (io.druid.data.input.MapBasedInputRow)1