Class StandardConversions
java.lang.Object
org.apache.drill.exec.physical.impl.scan.convert.StandardConversions
Factory for standard conversions as outlined in the package header.
Use the builder to add schema-wide properties from a provided schema,
from context-specific properties or both.
The class provides two kinds of information:
- A description of the conversion: whether the conversion is supported, whether it is lossy, and the class that can do the conversion.
- As a concrete conversion factory which provides the conversion class
if needed, the original column writer if no conversion is needed, or
null
if the conversion is not supported.
This class is not suitable if a reader requires a source-specific column converter or conversion rules. In that case, create a source-specific conversion factory.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
Definition of a conversion including conversion type and the standard conversion class (if available.)static enum
Indicates the type of conversion needed. -
Field Summary
Modifier and TypeFieldDescriptionstatic final StandardConversions.ConversionDefn
static final StandardConversions.ConversionDefn
static final StandardConversions.ConversionDefn
-
Method Summary
Modifier and TypeMethodDescriptionanalyze
(TypeProtos.MinorType inputType, ColumnMetadata outputSchema) analyze
(ColumnMetadata inputSchema, ColumnMetadata outputSchema) Create converters for standard cases.static StandardConversions.Builder
builder()
converterFor
(ScalarWriter scalarWriter, TypeProtos.MinorType inputType) converterFor
(ScalarWriter scalarWriter, TypeProtos.MinorType inputType, Map<String, String> columnProps) Create a direct column converter, if necessary, for the given input type and optional properties.converterFor
(ScalarWriter scalarWriter, ColumnMetadata inputSchema) Class<? extends DirectConverter>
convertFromVarchar
(ColumnMetadata outputDefn) newInstance
(Class<? extends DirectConverter> conversionClass, ScalarWriter baseWriter) newInstance
(Class<? extends DirectConverter> conversionClass, ScalarWriter baseWriter, Map<String, String> properties)
-
Field Details
-
IMPLICIT
-
IMPLICIT_UNSAFE
-
EXPLICIT
-
-
Method Details
-
builder
-
newInstance
public DirectConverter newInstance(Class<? extends DirectConverter> conversionClass, ScalarWriter baseWriter, Map<String, String> properties) -
newInstance
public DirectConverter newInstance(Class<? extends DirectConverter> conversionClass, ScalarWriter baseWriter) -
analyze
public StandardConversions.ConversionDefn analyze(ColumnMetadata inputSchema, ColumnMetadata outputSchema) Create converters for standard cases.Does not support any of the "legacy" decimal types.
- Parameters:
inputSchema
- the column schema for the input column which the client code (e.g. reader) wants to produceoutputSchema
- the column schema for the output vector to be produced by this operator- Returns:
- a description of the conversion needed (if any), along with the standard conversion class, if available
-
analyze
public StandardConversions.ConversionDefn analyze(TypeProtos.MinorType inputType, ColumnMetadata outputSchema) -
convertFromVarchar
-
converterFor
public ValueWriter converterFor(ScalarWriter scalarWriter, TypeProtos.MinorType inputType, Map<String, String> columnProps) Create a direct column converter, if necessary, for the given input type and optional properties. The properties provide formats and other type conversion hints needed for some conversions.- Parameters:
scalarWriter
- the output column writerinputType
- the type of the input datacolumnProps
- optional properties for some string-based conversions- Returns:
- a column converter, if needed and available, the input writer if no conversion is needed, or null if there is no conversion available
-
converterFor
-
converterFor
-