use of org.apache.drill.exec.store.kafka.KafkaStoragePlugin in project drill by apache.
the class AvroMessageReader method init.
@Override
public void init(SchemaNegotiator negotiator, ReadOptions readOptions, KafkaStoragePlugin plugin) {
Properties kafkaConsumerProps = plugin.getConfig().getKafkaConsumerProps();
Map<String, Object> propertiesMap = kafkaConsumerProps.entrySet().stream().collect(Collectors.toMap(e -> e.getKey().toString(), Map.Entry::getValue));
deserializer = new KafkaAvroDeserializer(null, propertiesMap);
TupleMetadata providedSchema = negotiator.providedSchema();
loader = negotiator.build();
AvroColumnConverterFactory factory = new AvroColumnConverterFactory(providedSchema);
converter = factory.getRootConverter(providedSchema, new TupleSchema(), loader.writer());
String keyDeserializer = kafkaConsumerProps.getProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG);
deserializeKey = keyDeserializer != null && keyDeserializer.equals(KafkaAvroDeserializer.class.getName());
}
Aggregations