use of org.apache.drill.exec.record.metadata.TupleSchema 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());
}
use of org.apache.drill.exec.record.metadata.TupleSchema in project drill by apache.
the class AbstractSchemaTracker method implicitColumns.
private TupleMetadata implicitColumns() {
TupleMetadata implicitCols = new TupleSchema();
for (ColumnHandle handle : schema.columns()) {
if (handle.isImplicit()) {
handle.setIndex(implicitCols.size());
implicitCols.addColumn(handle.column());
}
}
return implicitCols;
}
use of org.apache.drill.exec.record.metadata.TupleSchema in project drill by apache.
the class SchemaUtils method projectAll.
public static ScanProjectionParser.ProjectionParseResult projectAll() {
TupleMetadata projSet = new TupleSchema();
projSet.setProperty(ScanProjectionParser.PROJECTION_TYPE_PROP, ScanProjectionParser.PROJECT_ALL);
return new ScanProjectionParser.ProjectionParseResult(0, projSet);
}
use of org.apache.drill.exec.record.metadata.TupleSchema in project drill by apache.
the class SchemaUtils method projectNone.
public static ScanProjectionParser.ProjectionParseResult projectNone() {
TupleMetadata projSet = new TupleSchema();
projSet.setProperty(ScanProjectionParser.PROJECTION_TYPE_PROP, ScanProjectionParser.PROJECT_NONE);
return new ScanProjectionParser.ProjectionParseResult(-1, projSet);
}
use of org.apache.drill.exec.record.metadata.TupleSchema in project drill by apache.
the class EnumerableRecordReader method open.
@Override
public boolean open(SchemaNegotiator negotiator) {
TupleMetadata providedSchema = negotiator.providedSchema();
loader = negotiator.build();
setup(negotiator.context());
ColumnConverterFactory factory = new ColumnConverterFactory(providedSchema);
converter = factory.getRootConverter(providedSchema, new TupleSchema(), loader.writer());
return true;
}
Aggregations