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, typeFields 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_SUFFIXFields inherited from interface org.apache.drill.exec.record.metadata.Propertied
DRILL_PROP_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionPrimitiveColumnMetadata(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.intGet the expected width for a column.booleanReport whether one column is equivalent to another.booleanisScalar()booleanmergeWith(MaterializedField field) intReturns precision for current column.intscale()Returns scale for current column.schema()voidsetExpectedWidth(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.MinorTypevalue.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, variantSchemaMethods inherited from class org.apache.drill.exec.record.metadata.AbstractPropertied
booleanProperty, booleanProperty, hashCode, hasProperties, intProperty, intProperty, property, property, removeProperty, setBooleanProperty, setIntProperty, setProperties, setPropertyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:ColumnMetadataGet 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:
expectedWidthin interfaceColumnMetadata- Overrides:
expectedWidthin 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:AbstractColumnMetadataReturns 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:
precisionin interfaceColumnMetadata- Overrides:
precisionin classAbstractColumnMetadata- Returns:
- precision for current column
-
scale
public int scale()Description copied from class:AbstractColumnMetadataReturns 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:
scalein interfaceColumnMetadata- Overrides:
scalein classAbstractColumnMetadata- Returns:
- scale for current column
-
setExpectedWidth
public void setExpectedWidth(int width) Description copied from interface:ColumnMetadataFor variable-width columns, specify the expected column width to be used when allocating a new vector. Does nothing for fixed-width columns.- Specified by:
setExpectedWidthin interfaceColumnMetadata- Overrides:
setExpectedWidthin classAbstractColumnMetadata- Parameters:
width- the expected column width
-
dateTimeFormatter
Description copied from interface:ColumnMetadataReturns the formatter to use for date/time values. Only valid for date/time columns.- Specified by:
dateTimeFormatterin interfaceColumnMetadata- Overrides:
dateTimeFormatterin classAbstractColumnMetadata- Returns:
-
cloneEmpty
Description copied from interface:ColumnMetadataCreate 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:
majorTypein interfaceColumnMetadata- Overrides:
majorTypein classAbstractColumnMetadata
-
schema
-
emptySchema
-
typeString
Description copied from interface:ColumnMetadataConverts type metadata into string representation accepted by the table schema parser.- Specified by:
typeStringin interfaceColumnMetadata- Specified by:
typeStringin classAbstractColumnMetadata- Returns:
- type metadata string representation
-
valueFromString
Converts value in string literal form into Object instance based onTypeProtos.MinorTypevalue. Returns null in case of error during parsing or unsupported type.- Specified by:
valueFromStringin interfaceColumnMetadata- Overrides:
valueFromStringin 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:
valueToStringin interfaceColumnMetadata- Overrides:
valueToStringin classAbstractColumnMetadata- Parameters:
value- value instance- Returns:
- value in string literal representation
-
isEquivalent
Description copied from interface:ColumnMetadataReport 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:
isEquivalentin interfaceColumnMetadata- Overrides:
isEquivalentin classAbstractColumnMetadata
-
isScalar
public boolean isScalar()- Specified by:
isScalarin interfaceColumnMetadata- Overrides:
isScalarin classAbstractColumnMetadata
-
isSchemaForUnknown
public boolean isSchemaForUnknown()- Returns:
- true in case this primitive is created for unknown schema, for instance the column with all null values
-