Search in sources :

Example 1 with AvroParquetHDFSRecordWriter

use of org.apache.nifi.processors.parquet.record.AvroParquetHDFSRecordWriter in project nifi by apache.

the class PutParquet method createHDFSRecordWriter.

@Override
public HDFSRecordWriter createHDFSRecordWriter(final ProcessContext context, final FlowFile flowFile, final Configuration conf, final Path path, final RecordSchema schema) throws IOException, SchemaNotFoundException {
    final Schema avroSchema = AvroTypeUtil.extractAvroSchema(schema);
    final AvroParquetWriter.Builder<GenericRecord> parquetWriter = AvroParquetWriter.<GenericRecord>builder(path).withSchema(avroSchema);
    applyCommonConfig(parquetWriter, context, flowFile, conf);
    return new AvroParquetHDFSRecordWriter(parquetWriter.build(), avroSchema);
}
Also used : RecordSchema(org.apache.nifi.serialization.record.RecordSchema) Schema(org.apache.avro.Schema) AvroParquetWriter(org.apache.parquet.avro.AvroParquetWriter) AvroParquetHDFSRecordWriter(org.apache.nifi.processors.parquet.record.AvroParquetHDFSRecordWriter) GenericRecord(org.apache.avro.generic.GenericRecord)

Aggregations

Schema (org.apache.avro.Schema)1 GenericRecord (org.apache.avro.generic.GenericRecord)1 AvroParquetHDFSRecordWriter (org.apache.nifi.processors.parquet.record.AvroParquetHDFSRecordWriter)1 RecordSchema (org.apache.nifi.serialization.record.RecordSchema)1 AvroParquetWriter (org.apache.parquet.avro.AvroParquetWriter)1