Search in sources :

Example 1 with FileEntity

use of org.apache.druid.data.input.impl.FileEntity in project druid by druid-io.

the class AvroOCFReaderTest method createReader.

private InputEntityReader createReader(ObjectMapper mapper, Map<String, Object> readerSchema) throws Exception {
    final GenericRecord someAvroDatum = AvroStreamInputRowParserTest.buildSomeAvroDatum();
    final File someAvroFile = AvroHadoopInputRowParserTest.createAvroFile(someAvroDatum);
    final TimestampSpec timestampSpec = new TimestampSpec("timestamp", "auto", null);
    final DimensionsSpec dimensionsSpec = new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("eventType")));
    final AvroOCFInputFormat inputFormat = new AvroOCFInputFormat(mapper, null, readerSchema, null, null);
    final InputRowSchema schema = new InputRowSchema(timestampSpec, dimensionsSpec, ColumnsFilter.all());
    final FileEntity entity = new FileEntity(someAvroFile);
    return inputFormat.createReader(schema, entity, temporaryFolder.newFolder());
}
Also used : FileEntity(org.apache.druid.data.input.impl.FileEntity) TimestampSpec(org.apache.druid.data.input.impl.TimestampSpec) DimensionsSpec(org.apache.druid.data.input.impl.DimensionsSpec) InputRowSchema(org.apache.druid.data.input.InputRowSchema) GenericRecord(org.apache.avro.generic.GenericRecord) File(java.io.File)

Example 2 with FileEntity

use of org.apache.druid.data.input.impl.FileEntity in project druid by druid-io.

the class BaseParquetReaderTest method createReader.

InputEntityReader createReader(String parquetFile, InputRowSchema schema, JSONPathSpec flattenSpec, boolean binaryAsString) {
    FileEntity entity = new FileEntity(new File(parquetFile));
    ParquetInputFormat parquet = new ParquetInputFormat(flattenSpec, binaryAsString, new Configuration());
    return parquet.createReader(schema, entity, null);
}
Also used : FileEntity(org.apache.druid.data.input.impl.FileEntity) Configuration(org.apache.hadoop.conf.Configuration) File(java.io.File)

Example 3 with FileEntity

use of org.apache.druid.data.input.impl.FileEntity in project druid by druid-io.

the class OrcReaderTest method createReader.

private InputEntityReader createReader(TimestampSpec timestampSpec, DimensionsSpec dimensionsSpec, InputFormat inputFormat, String dataFile) throws IOException {
    final InputRowSchema schema = new InputRowSchema(timestampSpec, dimensionsSpec, ColumnsFilter.all());
    final FileEntity entity = new FileEntity(new File(dataFile));
    return inputFormat.createReader(schema, entity, temporaryFolder.newFolder());
}
Also used : FileEntity(org.apache.druid.data.input.impl.FileEntity) InputRowSchema(org.apache.druid.data.input.InputRowSchema) File(java.io.File)

Aggregations

File (java.io.File)3 FileEntity (org.apache.druid.data.input.impl.FileEntity)3 InputRowSchema (org.apache.druid.data.input.InputRowSchema)2 GenericRecord (org.apache.avro.generic.GenericRecord)1 DimensionsSpec (org.apache.druid.data.input.impl.DimensionsSpec)1 TimestampSpec (org.apache.druid.data.input.impl.TimestampSpec)1 Configuration (org.apache.hadoop.conf.Configuration)1