Class PrimitiveColumnMetadata
java.lang.Object
org.apache.drill.exec.record.metadata.AbstractPropertied
org.apache.drill.exec.record.metadata.AbstractColumnMetadata
org.apache.drill.exec.record.metadata.PrimitiveColumnMetadata
- All Implemented Interfaces:
ColumnMetadata
,Propertied
Primitive (non-map) column. Describes non-nullable, nullable and array types
(which differ only in mode, but not in metadata structure.)
Metadata is of two types:
- Storage metadata that describes how the column is materialized in a vector. Storage metadata is immutable because revising an existing vector is a complex operation.
- Supplemental metadata used when reading or writing the column. Supplemental metadata can be changed after the column is created, though it should generally be set before invoking code that uses the metadata.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.drill.exec.record.metadata.ColumnMetadata
ColumnMetadata.StructureType
-
Field Summary
Fields inherited from class org.apache.drill.exec.record.metadata.AbstractColumnMetadata
mode, name, precision, scale, type
Fields inherited from interface org.apache.drill.exec.record.metadata.ColumnMetadata
BLANK_AS_NULL, BLANK_AS_PROP, BLANK_AS_ZERO, DEFAULT_ARRAY_SIZE, DEFAULT_VALUE_PROP, EXCLUDE_FROM_WILDCARD, EXPECTED_CARDINALITY_PROP, EXPECTED_WIDTH_PROP, FORMAT_PROP, IMPLICIT_COL_TYPE, IMPLICIT_FILENAME, IMPLICIT_FILEPATH, IMPLICIT_FQN, IMPLICIT_PARTITION_PREFIX, IMPLICIT_SUFFIX
Fields inherited from interface org.apache.drill.exec.record.metadata.Propertied
DRILL_PROP_PREFIX
-
Constructor Summary
ConstructorDescriptionPrimitiveColumnMetadata
(String name, TypeProtos.MajorType type) PrimitiveColumnMetadata
(String name, TypeProtos.MinorType type, TypeProtos.DataMode mode) PrimitiveColumnMetadata
(String name, TypeProtos.MinorType type, TypeProtos.DataMode mode, boolean forUnknownSchema) -
Method Summary
Modifier and TypeMethodDescriptionCreate an empty version of this column.copy()
Returns the formatter to use for date/time values.int
Get the expected width for a column.boolean
Report whether one column is equivalent to another.boolean
isScalar()
boolean
mergeWith
(MaterializedField field) int
Returns precision for current column.int
scale()
Returns scale for current column.schema()
void
setExpectedWidth
(int width) For variable-width columns, specify the expected column width to be used when allocating a new vector.Converts type metadata into string representation accepted by the table schema parser.valueFromString
(String value) Converts value in string literal form into Object instance based onTypeProtos.MinorType
value.valueToString
(Object value) Converts given value instance into String literal representation based on column metadata type.Methods inherited from class org.apache.drill.exec.record.metadata.AbstractColumnMetadata
appendContents, bind, childSchema, columnString, createColumnMetadata, decodeDefaultValue, defaultValue, dimensions, equals, equalsWithProperties, equalsWithProperties, escapeSpecialSymbols, expectedElementCount, format, isArray, isDict, isDynamic, isMap, isMultiList, isNullable, isVariableWidth, isVariant, mode, name, properties, setDefaultValue, setExpectedElementCount, setFormat, toString, tupleSchema, type, variantSchema
Methods inherited from class org.apache.drill.exec.record.metadata.AbstractPropertied
booleanProperty, booleanProperty, hashCode, hasProperties, intProperty, intProperty, property, property, removeProperty, setBooleanProperty, setIntProperty, setProperties, setProperty
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.drill.exec.record.metadata.Propertied
booleanProperty, booleanProperty, hasProperties, intProperty, intProperty, property, property, removeProperty, setBooleanProperty, setIntProperty, setProperties, setProperty
-
Constructor Details
-
PrimitiveColumnMetadata
-
PrimitiveColumnMetadata
-
PrimitiveColumnMetadata
-
PrimitiveColumnMetadata
public PrimitiveColumnMetadata(String name, TypeProtos.MinorType type, TypeProtos.DataMode mode, boolean forUnknownSchema) -
PrimitiveColumnMetadata
-
-
Method Details
-
copy
-
structureType
-
expectedWidth
public int expectedWidth()Description copied from interface:ColumnMetadata
Get the expected width for a column. This is the actual width for fixed- width columns, the specified width (defaulting to 50) for variable-width columns.- Specified by:
expectedWidth
in interfaceColumnMetadata
- Overrides:
expectedWidth
in classAbstractColumnMetadata
- Returns:
- the expected column width of the each data value. Does not include "overhead" space such as for the null-value vector or offset vector
-
precision
public int precision()Description copied from class:AbstractColumnMetadata
Returns precision for current column. For the case when precision is not set or column type does not support precision, negative value will be returned.- Specified by:
precision
in interfaceColumnMetadata
- Overrides:
precision
in classAbstractColumnMetadata
- Returns:
- precision for current column
-
scale
public int scale()Description copied from class:AbstractColumnMetadata
Returns scale for current column. For the case when scale is not set or column type does not support scale, negative value will be returned.- Specified by:
scale
in interfaceColumnMetadata
- Overrides:
scale
in classAbstractColumnMetadata
- Returns:
- scale for current column
-
setExpectedWidth
public void setExpectedWidth(int width) Description copied from interface:ColumnMetadata
For variable-width columns, specify the expected column width to be used when allocating a new vector. Does nothing for fixed-width columns.- Specified by:
setExpectedWidth
in interfaceColumnMetadata
- Overrides:
setExpectedWidth
in classAbstractColumnMetadata
- Parameters:
width
- the expected column width
-
dateTimeFormatter
Description copied from interface:ColumnMetadata
Returns the formatter to use for date/time values. Only valid for date/time columns.- Specified by:
dateTimeFormatter
in interfaceColumnMetadata
- Overrides:
dateTimeFormatter
in classAbstractColumnMetadata
- Returns:
-
cloneEmpty
Description copied from interface:ColumnMetadata
Create an empty version of this column. If the column is a scalar, produces a simple copy. If a map, produces a clone without child columns.- Returns:
- empty clone of this column
-
mergeWith
-
majorType
- Specified by:
majorType
in interfaceColumnMetadata
- Overrides:
majorType
in classAbstractColumnMetadata
-
schema
-
emptySchema
-
typeString
Description copied from interface:ColumnMetadata
Converts type metadata into string representation accepted by the table schema parser.- Specified by:
typeString
in interfaceColumnMetadata
- Specified by:
typeString
in classAbstractColumnMetadata
- Returns:
- type metadata string representation
-
valueFromString
Converts value in string literal form into Object instance based onTypeProtos.MinorType
value. Returns null in case of error during parsing or unsupported type.- Specified by:
valueFromString
in interfaceColumnMetadata
- Overrides:
valueFromString
in classAbstractColumnMetadata
- Parameters:
value
- value in string literal form- Returns:
- Object instance
-
valueToString
Converts given value instance into String literal representation based on column metadata type.- Specified by:
valueToString
in interfaceColumnMetadata
- Overrides:
valueToString
in classAbstractColumnMetadata
- Parameters:
value
- value instance- Returns:
- value in string literal representation
-
isEquivalent
Description copied from interface:ColumnMetadata
Report whether one column is equivalent to another. Columns are equivalent if they have the same name, type and structure (ignoring internal structure such as properties.)- Specified by:
isEquivalent
in interfaceColumnMetadata
- Overrides:
isEquivalent
in classAbstractColumnMetadata
-
isScalar
public boolean isScalar()- Specified by:
isScalar
in interfaceColumnMetadata
- Overrides:
isScalar
in classAbstractColumnMetadata
-
isSchemaForUnknown
public boolean isSchemaForUnknown()- Returns:
- true in case this primitive is created for unknown schema, for instance the column with all null values
-