public class ScanLifecycleBuilder extends Object
ScanLifecycle
then builds a scan lifecycle
instance.
This framework is a bridge between operator logic and the scan internals. It gathers scan-specific options in a builder abstraction, then passes them on the scan lifecycle at the right time. By abstracting out this plumbing, a scan batch creator simply chooses the proper framework builder, passes config options, and implements the matching "managed reader" and factory. All details of setup, projection, and so on are handled by the framework and the components that the framework builds upon.
In practice, there are other options to fine tune behavior (provided schema, custom error context, various limits, etc.)
Modifier and Type | Class and Description |
---|---|
static class |
ScanLifecycleBuilder.DummyReaderFactory |
static interface |
ScanLifecycleBuilder.SchemaValidator |
Modifier and Type | Field and Description |
---|---|
protected boolean |
allowRequiredNullColumns |
protected boolean |
allowSchemaChange
Option to disable schema changes.
|
static int |
DEFAULT_BATCH_BYTE_COUNT |
static int |
DEFAULT_BATCH_ROW_COUNT |
protected TupleMetadata |
definedSchema |
protected boolean |
disableEmptyResults
Option to disable empty results.
|
protected boolean |
enableSchemaBatch
Option that enables whether the scan operator starts with an empty
schema-only batch (the so-called "fast schema" that Drill once tried
to provide) or starts with a non-empty data batch (which appears to
be the standard since the "Empty Batches" project some time back.)
See more details in
OperatorDriver Javadoc. |
protected CustomErrorContext |
errorContext
Context for error messages.
|
static int |
MAX_BATCH_BYTE_SIZE |
static int |
MAX_BATCH_ROW_COUNT |
static int |
MIN_BATCH_BYTE_SIZE |
protected TypeProtos.MajorType |
nullType |
protected TupleMetadata |
providedSchema |
protected ScanLifecycleBuilder.SchemaValidator |
schemaValidator
Optional schema validator to perform per-scan checks of the
projection or resolved schema.
|
protected String |
userName |
Constructor and Description |
---|
ScanLifecycleBuilder() |
public static final int MIN_BATCH_BYTE_SIZE
public static final int MAX_BATCH_BYTE_SIZE
public static final int DEFAULT_BATCH_ROW_COUNT
public static final int DEFAULT_BATCH_BYTE_COUNT
public static final int MAX_BATCH_ROW_COUNT
protected String userName
protected TypeProtos.MajorType nullType
protected boolean allowRequiredNullColumns
protected TupleMetadata definedSchema
protected TupleMetadata providedSchema
protected boolean enableSchemaBatch
OperatorDriver
Javadoc.
Defaults to false, meaning to not provide the empty schema batch. DRILL-7305 explains that many operators fail when presented with an empty batch, so do not enable this feature until those issues are fixed. Of course, do enable the feature if you want to track down the DRILL-7305 bugs.
protected boolean disableEmptyResults
Disabling this option is not desirable: it means that the user gets no schema for queries that should be able to return one. So, disable this option only if we cannot find or fix empty-batch bugs.
protected boolean allowSchemaChange
false
, then the first
batch commits the scan to a single, unchanged schema. If true
(the legacy default), then each batch or reader can change the schema,
even though downstream operators generally cannot handle a schema
change. The goal is to evolve all readers so that they do not
generate schema changes.protected ScanLifecycleBuilder.SchemaValidator schemaValidator
protected CustomErrorContext errorContext
public void options(OptionSet options)
public OptionSet options()
public void readerFactory(ReaderFactory<?> readerFactory)
public void userName(String userName)
public String userName()
public void batchRecordLimit(int batchRecordLimit)
batchRecordLimit
- maximum records per batchpublic void batchByteLimit(int byteLimit)
public void nullType(TypeProtos.MajorType nullType)
nullType
- the type to use for null columnspublic void allowRequiredNullColumns(boolean flag)
public boolean allowRequiredNullColumns()
public void allowSchemaChange(boolean flag)
public boolean allowSchemaChange()
public void projection(List<SchemaPath> projection)
public void enableSchemaBatch(boolean option)
public void disableEmptyResults(boolean option)
public void definedSchema(TupleMetadata definedSchema)
public TupleMetadata definedSchema()
public void providedSchema(TupleMetadata providedSchema)
public TupleMetadata providedSchema()
public void errorContext(CustomErrorContext context)
public CustomErrorContext errorContext()
public List<SchemaPath> projection()
public int scanBatchRecordLimit()
public int scanBatchByteLimit()
public TypeProtos.MajorType nullType()
public ReaderFactory<?> readerFactory()
public void schemaValidator(ScanLifecycleBuilder.SchemaValidator schemaValidator)
public ScanLifecycleBuilder.SchemaValidator schemaValidator()
public void limit(long limit)
public long limit()
public ScanLifecycle build(OperatorContext context)
public ScanOperatorExec buildScan()
public OperatorRecordBatch buildScanOperator(FragmentContext fragContext, PhysicalOperator pop)
Copyright © 1970 The Apache Software Foundation. All rights reserved.