public abstract class AbstractColumnMetadata extends AbstractPropertied implements ColumnMetadata
Note that, by design, primitive columns do not have a link to their tuple parent, or their index within that parent. This allows the same metadata to be shared between two views of a tuple, perhaps physical and projected views. This restriction does not apply to map columns, since maps (and the row itself) will, by definition, differ between the two views.
ColumnMetadata.StructureType
Modifier and Type | Field and Description |
---|---|
protected TypeProtos.DataMode |
mode |
protected String |
name |
protected int |
precision |
protected int |
scale |
protected TypeProtos.MinorType |
type |
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
DRILL_PROP_PREFIX
Constructor and Description |
---|
AbstractColumnMetadata(AbstractColumnMetadata from) |
AbstractColumnMetadata(MaterializedField schema) |
AbstractColumnMetadata(String name,
TypeProtos.MajorType majorType) |
AbstractColumnMetadata(String name,
TypeProtos.MinorType type,
TypeProtos.DataMode mode) |
Modifier and Type | Method and Description |
---|---|
protected void |
appendContents(StringBuilder buf) |
void |
bind(TupleMetadata parentTuple) |
ColumnMetadata |
childSchema()
Schema of inner dimension for MULTI_ARRAY columns.
|
String |
columnString()
Converts column metadata into string representation
accepted by the table schema parser.
|
static AbstractColumnMetadata |
createColumnMetadata(String name,
String type,
TypeProtos.DataMode mode,
Map<String,String> properties) |
DateTimeFormatter |
dateTimeFormatter()
Returns the formatter to use for date/time values.
|
Object |
decodeDefaultValue()
Returns the default value decoded into object form.
|
String |
defaultValue()
Returns the default value for this column in String literal representation.
|
int |
dimensions() |
boolean |
equals(Object o) |
boolean |
equalsWithProperties(AbstractColumnMetadata other) |
boolean |
equalsWithProperties(Object o) |
protected String |
escapeSpecialSymbols(String value)
If given value contains backticks (`) or backslashes (\), escapes them.
|
int |
expectedElementCount()
Returns the expected array cardinality for array columns, or 1 for
non-array columns.
|
int |
expectedWidth()
Get the expected width for a column.
|
String |
format() |
boolean |
isArray() |
boolean |
isDict() |
boolean |
isDynamic()
Reports if the column is dynamic.
|
boolean |
isEquivalent(ColumnMetadata o)
Report whether one column is equivalent to another.
|
boolean |
isMap() |
boolean |
isMultiList()
Determine if the schema represents a column with a LIST type with
UNION elements.
|
boolean |
isNullable() |
boolean |
isVariableWidth() |
boolean |
isVariant() |
TypeProtos.MajorType |
majorType() |
TypeProtos.DataMode |
mode() |
String |
name() |
int |
precision()
Returns precision for current column.
|
Map<String,String> |
properties() |
int |
scale()
Returns scale for current column.
|
void |
setDefaultValue(String value)
Sets the default value property using the string-encoded form of the value.
|
void |
setExpectedElementCount(int childCount)
For an array column, specify the expected average array cardinality.
|
void |
setExpectedWidth(int width)
For variable-width columns, specify the expected column width to be used
when allocating a new vector.
|
void |
setFormat(String value) |
String |
toString() |
TupleMetadata |
tupleSchema()
Schema for TUPLE columns.
|
TypeProtos.MinorType |
type() |
abstract String |
typeString()
Converts type metadata into string representation
accepted by the table schema parser.
|
Object |
valueFromString(String value) |
String |
valueToString(Object value) |
VariantMetadata |
variantSchema()
Schema for VARIANT columns.
|
booleanProperty, booleanProperty, hashCode, hasProperties, intProperty, intProperty, property, property, removeProperty, setBooleanProperty, setIntProperty, setProperties, setProperty
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
cloneEmpty, copy, emptySchema, schema, structureType
booleanProperty, booleanProperty, hasProperties, intProperty, intProperty, pluginPrefix, property, property, removeProperty, setBooleanProperty, setIntProperty, setProperties, setProperty
protected final String name
protected final TypeProtos.MinorType type
protected final TypeProtos.DataMode mode
protected final int precision
protected final int scale
public AbstractColumnMetadata(MaterializedField schema)
public AbstractColumnMetadata(String name, TypeProtos.MajorType majorType)
public AbstractColumnMetadata(String name, TypeProtos.MinorType type, TypeProtos.DataMode mode)
public AbstractColumnMetadata(AbstractColumnMetadata from)
public static AbstractColumnMetadata createColumnMetadata(String name, String type, TypeProtos.DataMode mode, Map<String,String> properties) throws IOException
IOException
public void bind(TupleMetadata parentTuple)
bind
in interface ColumnMetadata
public String name()
name
in interface ColumnMetadata
public TypeProtos.MinorType type()
type
in interface ColumnMetadata
public TypeProtos.MajorType majorType()
majorType
in interface ColumnMetadata
public TypeProtos.DataMode mode()
mode
in interface ColumnMetadata
public boolean isNullable()
isNullable
in interface ColumnMetadata
public boolean isArray()
isArray
in interface ColumnMetadata
public int dimensions()
dimensions
in interface ColumnMetadata
public boolean isMap()
isMap
in interface ColumnMetadata
public boolean isVariant()
isVariant
in interface ColumnMetadata
public boolean isMultiList()
ColumnMetadata
isMultiList
in interface ColumnMetadata
public boolean isDict()
isDict
in interface ColumnMetadata
public boolean isDynamic()
ColumnMetadata
isDynamic
in interface ColumnMetadata
true
if the column does not yet have a concrete
type, false
if the column type is concretepublic TupleMetadata tupleSchema()
ColumnMetadata
tupleSchema
in interface ColumnMetadata
public VariantMetadata variantSchema()
ColumnMetadata
variantSchema
in interface ColumnMetadata
public ColumnMetadata childSchema()
ColumnMetadata
Sorry for the mess, but it is how the code works and we are not in a position to revisit data type fundamentals.
childSchema
in interface ColumnMetadata
public boolean isVariableWidth()
isVariableWidth
in interface ColumnMetadata
public boolean isEquivalent(ColumnMetadata o)
ColumnMetadata
isEquivalent
in interface ColumnMetadata
public boolean equalsWithProperties(AbstractColumnMetadata other)
public int expectedWidth()
ColumnMetadata
expectedWidth
in interface ColumnMetadata
public void setExpectedWidth(int width)
ColumnMetadata
setExpectedWidth
in interface ColumnMetadata
width
- the expected column widthpublic int precision()
precision
in interface ColumnMetadata
public int scale()
scale
in interface ColumnMetadata
public void setExpectedElementCount(int childCount)
ColumnMetadata
setExpectedElementCount
in interface ColumnMetadata
childCount
- the expected average array cardinality. Defaults to
1 for non-array columns, 10 for array columnspublic int expectedElementCount()
ColumnMetadata
expectedElementCount
in interface ColumnMetadata
public void setFormat(String value)
setFormat
in interface ColumnMetadata
public String format()
format
in interface ColumnMetadata
public DateTimeFormatter dateTimeFormatter()
ColumnMetadata
dateTimeFormatter
in interface ColumnMetadata
public void setDefaultValue(String value)
ColumnMetadata
setDefaultValue
in interface ColumnMetadata
value
- the default value in String representationpublic String defaultValue()
ColumnMetadata
defaultValue
in interface ColumnMetadata
public Object decodeDefaultValue()
ColumnMetadata
decodeValue(defaultValue());
decodeDefaultValue
in interface ColumnMetadata
ColumnWriter#setObject()
method.public Object valueFromString(String value)
valueFromString
in interface ColumnMetadata
public String valueToString(Object value)
valueToString
in interface ColumnMetadata
public Map<String,String> properties()
properties
in interface Propertied
properties
in class AbstractPropertied
protected void appendContents(StringBuilder buf)
public abstract String typeString()
ColumnMetadata
typeString
in interface ColumnMetadata
public String columnString()
ColumnMetadata
columnString
in interface ColumnMetadata
public boolean equals(Object o)
equals
in class AbstractPropertied
public boolean equalsWithProperties(Object o)
Copyright © 1970 The Apache Software Foundation. All rights reserved.