Search in sources :

Example 1 with ColumnConverterFactory

use of org.apache.drill.exec.record.ColumnConverterFactory 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;
}
Also used : ColumnConverterFactory(org.apache.drill.exec.record.ColumnConverterFactory) TupleMetadata(org.apache.drill.exec.record.metadata.TupleMetadata) TupleSchema(org.apache.drill.exec.record.metadata.TupleSchema)

Example 2 with ColumnConverterFactory

use of org.apache.drill.exec.record.ColumnConverterFactory in project drill by apache.

the class IcebergRecordReader method open.

@Override
public boolean open(SchemaNegotiator negotiator) {
    TupleSchema tableSchema = new TupleSchema();
    tableScan.schema().columns().stream().map(IcebergColumnConverterFactory::getColumnMetadata).forEach(tableSchema::add);
    TupleMetadata providedSchema = negotiator.providedSchema();
    TupleMetadata tupleSchema = FixedReceiver.Builder.mergeSchemas(providedSchema, tableSchema);
    negotiator.tableSchema(tupleSchema, true);
    loader = negotiator.build();
    this.taskToClose = new ScanTaskTableScanIterable(tableScan, work.getScanTask());
    this.records = taskToClose.iterator();
    ColumnConverterFactory factory = new IcebergColumnConverterFactory(providedSchema);
    converter = factory.getRootConverter(providedSchema, tableSchema, loader.writer());
    return true;
}
Also used : ScanTaskTableScanIterable(org.apache.iceberg.data.ScanTaskTableScanIterable) ColumnConverterFactory(org.apache.drill.exec.record.ColumnConverterFactory) TupleMetadata(org.apache.drill.exec.record.metadata.TupleMetadata) TupleSchema(org.apache.drill.exec.record.metadata.TupleSchema)

Aggregations

ColumnConverterFactory (org.apache.drill.exec.record.ColumnConverterFactory)2 TupleMetadata (org.apache.drill.exec.record.metadata.TupleMetadata)2 TupleSchema (org.apache.drill.exec.record.metadata.TupleSchema)2 ScanTaskTableScanIterable (org.apache.iceberg.data.ScanTaskTableScanIterable)1