Search in sources :

Example 1 with PojoRecordReader

use of org.apache.drill.exec.store.pojo.PojoRecordReader in project drill by apache.

the class SystemTableBatchCreator method getBatch.

//  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SystemTableBatchCreator.class);
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public ScanBatch getBatch(final FragmentContext context, final SystemTableScan scan, final List<RecordBatch> children) throws ExecutionSetupException {
    final SystemTable table = scan.getTable();
    final Iterator<Object> iterator = table.getIterator(context);
    final RecordReader reader = new PojoRecordReader(table.getPojoClass(), iterator);
    return new ScanBatch(scan, context, Collections.singleton(reader).iterator());
}
Also used : RecordReader(org.apache.drill.exec.store.RecordReader) PojoRecordReader(org.apache.drill.exec.store.pojo.PojoRecordReader) ScanBatch(org.apache.drill.exec.physical.impl.ScanBatch) PojoRecordReader(org.apache.drill.exec.store.pojo.PojoRecordReader)

Example 2 with PojoRecordReader

use of org.apache.drill.exec.store.pojo.PojoRecordReader in project drill by apache.

the class DirectPlan method createDirectPlan.

public static <T> PhysicalPlan createDirectPlan(DrillbitEndpoint endpoint, Iterator<T> iterator, Class<T> clazz) {
    PojoRecordReader<T> reader = new PojoRecordReader<T>(clazz, iterator);
    DirectGroupScan scan = new DirectGroupScan(reader);
    Screen screen = new Screen(scan, endpoint);
    PlanPropertiesBuilder propsBuilder = PlanProperties.builder();
    propsBuilder.type(PlanType.APACHE_DRILL_PHYSICAL);
    propsBuilder.version(1);
    propsBuilder.resultMode(ResultMode.EXEC);
    propsBuilder.generator(DirectPlan.class.getSimpleName(), "");
    return new PhysicalPlan(propsBuilder.build(), DefaultSqlHandler.getPops(screen));
}
Also used : PhysicalPlan(org.apache.drill.exec.physical.PhysicalPlan) Screen(org.apache.drill.exec.physical.config.Screen) DirectGroupScan(org.apache.drill.exec.store.direct.DirectGroupScan) PlanPropertiesBuilder(org.apache.drill.common.logical.PlanProperties.PlanPropertiesBuilder) PojoRecordReader(org.apache.drill.exec.store.pojo.PojoRecordReader)

Aggregations

PojoRecordReader (org.apache.drill.exec.store.pojo.PojoRecordReader)2 PlanPropertiesBuilder (org.apache.drill.common.logical.PlanProperties.PlanPropertiesBuilder)1 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)1 Screen (org.apache.drill.exec.physical.config.Screen)1 ScanBatch (org.apache.drill.exec.physical.impl.ScanBatch)1 RecordReader (org.apache.drill.exec.store.RecordReader)1 DirectGroupScan (org.apache.drill.exec.store.direct.DirectGroupScan)1