Search in sources :

Example 1 with ReaderFactory

use of org.apache.drill.exec.physical.impl.scan.framework.ManagedScanFramework.ReaderFactory in project drill by apache.

the class HttpScanBatchCreator method createBuilder.

private ScanFrameworkBuilder createBuilder(OptionManager options, HttpSubScan subScan) {
    ScanFrameworkBuilder builder = new ScanFrameworkBuilder();
    builder.projection(subScan.columns());
    builder.setUserName(subScan.getUserName());
    // Provide custom error context
    builder.errorContext(new ChildErrorContext(builder.errorContext()) {

        @Override
        public void addContext(UserException.Builder builder) {
            builder.addContext("Connection", subScan.tableSpec().connection());
            builder.addContext("Plugin", subScan.tableSpec().pluginName());
        }
    });
    // Reader
    ReaderFactory readerFactory = new HttpReaderFactory(subScan);
    builder.setReaderFactory(readerFactory);
    builder.nullType(Types.optional(MinorType.VARCHAR));
    return builder;
}
Also used : ScanFrameworkBuilder(org.apache.drill.exec.physical.impl.scan.framework.ManagedScanFramework.ScanFrameworkBuilder) ChildErrorContext(org.apache.drill.common.exceptions.ChildErrorContext) ReaderFactory(org.apache.drill.exec.physical.impl.scan.framework.ManagedScanFramework.ReaderFactory) UserException(org.apache.drill.common.exceptions.UserException)

Example 2 with ReaderFactory

use of org.apache.drill.exec.physical.impl.scan.framework.ManagedScanFramework.ReaderFactory in project drill by apache.

the class SplunkScanBatchCreator method createBuilder.

private ScanFrameworkBuilder createBuilder(OptionManager options, SplunkSubScan subScan) {
    SplunkPluginConfig config = subScan.getConfig();
    ScanFrameworkBuilder builder = new ScanFrameworkBuilder();
    builder.projection(subScan.getColumns());
    builder.setUserName(subScan.getUserName());
    // Reader
    ReaderFactory readerFactory = new SplunkReaderFactory(config, subScan);
    builder.setReaderFactory(readerFactory);
    builder.nullType(Types.optional(MinorType.VARCHAR));
    return builder;
}
Also used : ScanFrameworkBuilder(org.apache.drill.exec.physical.impl.scan.framework.ManagedScanFramework.ScanFrameworkBuilder) ReaderFactory(org.apache.drill.exec.physical.impl.scan.framework.ManagedScanFramework.ReaderFactory)

Example 3 with ReaderFactory

use of org.apache.drill.exec.physical.impl.scan.framework.ManagedScanFramework.ReaderFactory in project drill by apache.

the class PhoenixScanBatchCreator method createBuilder.

private ScanFrameworkBuilder createBuilder(OptionManager options, PhoenixSubScan subScan) {
    ScanFrameworkBuilder builder = new ScanFrameworkBuilder();
    builder.projection(subScan.getColumns());
    builder.setUserName(subScan.getUserName());
    // Phoenix reader
    ReaderFactory readerFactory = new PhoenixReaderFactory(subScan);
    builder.setReaderFactory(readerFactory);
    builder.nullType(Types.optional(MinorType.VARCHAR));
    // Add custom error context
    builder.errorContext(new ChildErrorContext(builder.errorContext()) {

        @Override
        public void addContext(UserException.Builder builder) {
            builder.addContext("sql : ", subScan.getScanSpec().getSql());
            builder.addContext("columns : ", subScan.getScanSpec().getColumns().toString());
            builder.addContext("estimate row count : ", subScan.getScanSpec().getEstimateRows());
        }
    });
    return builder;
}
Also used : ScanFrameworkBuilder(org.apache.drill.exec.physical.impl.scan.framework.ManagedScanFramework.ScanFrameworkBuilder) ChildErrorContext(org.apache.drill.common.exceptions.ChildErrorContext) ReaderFactory(org.apache.drill.exec.physical.impl.scan.framework.ManagedScanFramework.ReaderFactory) UserException(org.apache.drill.common.exceptions.UserException)

Aggregations

ReaderFactory (org.apache.drill.exec.physical.impl.scan.framework.ManagedScanFramework.ReaderFactory)3 ScanFrameworkBuilder (org.apache.drill.exec.physical.impl.scan.framework.ManagedScanFramework.ScanFrameworkBuilder)3 ChildErrorContext (org.apache.drill.common.exceptions.ChildErrorContext)2 UserException (org.apache.drill.common.exceptions.UserException)2