use of org.apache.iceberg.data.ScanTaskTableScanIterable 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;
}
Aggregations