Search in sources :

Example 1 with KuduScannerBuilder

use of org.apache.kudu.client.KuduScanner.KuduScannerBuilder in project drill by apache.

the class KuduRecordReader method setup.

@Override
public void setup(OperatorContext context, OutputMutator output) throws ExecutionSetupException {
    this.output = output;
    this.context = context;
    try {
        KuduTable table = client.openTable(scanSpec.getTableName());
        KuduScannerBuilder builder = client.newScannerBuilder(table);
        if (!isStarQuery()) {
            List<String> colNames = Lists.newArrayList();
            for (SchemaPath p : this.getColumns()) {
                colNames.add(p.getAsUnescapedPath());
            }
            builder.setProjectedColumnNames(colNames);
        }
        context.getStats().startWait();
        try {
            scanner = builder.lowerBoundRaw(scanSpec.getStartKey()).exclusiveUpperBoundRaw(scanSpec.getEndKey()).build();
        } finally {
            context.getStats().stopWait();
        }
    } catch (Exception e) {
        throw new ExecutionSetupException(e);
    }
}
Also used : ExecutionSetupException(org.apache.drill.common.exceptions.ExecutionSetupException) KuduScannerBuilder(org.apache.kudu.client.KuduScanner.KuduScannerBuilder) SchemaPath(org.apache.drill.common.expression.SchemaPath) KuduTable(org.apache.kudu.client.KuduTable) UserException(org.apache.drill.common.exceptions.UserException) ExecutionSetupException(org.apache.drill.common.exceptions.ExecutionSetupException) SchemaChangeException(org.apache.drill.exec.exception.SchemaChangeException)

Aggregations

ExecutionSetupException (org.apache.drill.common.exceptions.ExecutionSetupException)1 UserException (org.apache.drill.common.exceptions.UserException)1 SchemaPath (org.apache.drill.common.expression.SchemaPath)1 SchemaChangeException (org.apache.drill.exec.exception.SchemaChangeException)1 KuduScannerBuilder (org.apache.kudu.client.KuduScanner.KuduScannerBuilder)1 KuduTable (org.apache.kudu.client.KuduTable)1