Class MetadataUtils
java.lang.Object
org.apache.drill.exec.record.metadata.MetadataUtils
A collection of utility methods for working with column and tuple metadata.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ColumnMetadata
cloneMapWithSchema
(ColumnMetadata source, TupleMetadata members) static ColumnMetadata
diffMap
(ColumnMetadata map, ColumnMetadata other) static TupleMetadata
diffTuple
(TupleMetadata base, TupleMetadata subtend) static TupleSchema
fromColumns
(List<ColumnMetadata> columns) Create a tuple given the list of columns that make up the tuple.static ColumnMetadata
fromField
(MaterializedField field) Create a column metadata object that holds the givenMaterializedField
.static TupleSchema
fromFields
(Iterable<MaterializedField> fields) static ColumnMetadata
fromView
(MaterializedField field) static boolean
hasDynamicColumns
(TupleMetadata schema) static boolean
static boolean
static boolean
isScalar
(TypeProtos.MinorType type) static boolean
isScalar
(ColumnMetadata col) static boolean
isWildcard
(ColumnMetadata col) static ColumnMetadata
newDecimal
(String name, TypeProtos.DataMode mode, int precision, int scale) static ColumnMetadata
newDecimal
(String name, TypeProtos.MinorType type, TypeProtos.DataMode mode, int precision, int scale) static DictColumnMetadata
static DictColumnMetadata
newDict
(MaterializedField field) static DictColumnMetadata
newDict
(MaterializedField field, TupleSchema schema) static DictColumnMetadata
newDictArray
(String name) static ColumnMetadata
newDynamic
(String name) static MapColumnMetadata
static MapColumnMetadata
newMap
(String name, TypeProtos.DataMode dataMode, TupleMetadata schema) static MapColumnMetadata
newMap
(String name, TupleMetadata schema) static MapColumnMetadata
newMap
(MaterializedField field) static MapColumnMetadata
newMap
(MaterializedField field, TupleSchema schema) Create a column metadata object for a map column, given theMaterializedField
that describes the column, and a list of column metadata objects that describe the columns in the map.static ColumnMetadata
newMapArray
(String name) static ColumnMetadata
newMapArray
(String name, TupleMetadata schema) static RepeatedListColumnMetadata
newRepeatedList
(String name, ColumnMetadata child) static PrimitiveColumnMetadata
newScalar
(String name, TypeProtos.MajorType type) static PrimitiveColumnMetadata
newScalar
(String name, TypeProtos.MinorType type, TypeProtos.DataMode mode) static PrimitiveColumnMetadata
newScalar
(String name, TypeProtos.MinorType type, TypeProtos.DataMode mode, boolean schemaForUnknown) static VariantColumnMetadata
newVariant
(String name, TypeProtos.DataMode cardinality) static VariantColumnMetadata
newVariant
(MaterializedField field, VariantSchema schema) static ColumnMetadata
wildcard()
-
Constructor Details
-
MetadataUtils
public MetadataUtils()
-
-
Method Details
-
fromFields
-
fromField
Create a column metadata object that holds the givenMaterializedField
. The type of the object will be either a primitive, map or dict column, depending on the field's type. The logic here mimics the code as written, which is very messy in some places.- Parameters:
field
- the materialized field to wrap- Returns:
- the column metadata that wraps the field
-
fromView
-
fromColumns
Create a tuple given the list of columns that make up the tuple. Creates nested maps as needed.- Parameters:
columns
- list of columns that make up the tuple- Returns:
- a tuple metadata object that contains the columns
-
newMap
Create a column metadata object for a map column, given theMaterializedField
that describes the column, and a list of column metadata objects that describe the columns in the map.- Parameters:
field
- the materialized field that describes the map columnschema
- metadata that describes the tuple of columns in the map- Returns:
- a map column metadata for the map
-
newMap
-
newMap
-
newMap
-
newDict
-
newDict
-
newDict
-
newVariant
-
newVariant
-
newRepeatedList
-
newMapArray
-
newMap
public static MapColumnMetadata newMap(String name, TypeProtos.DataMode dataMode, TupleMetadata schema) -
newMapArray
-
newDictArray
-
newScalar
public static PrimitiveColumnMetadata newScalar(String name, TypeProtos.MinorType type, TypeProtos.DataMode mode) -
newScalar
public static PrimitiveColumnMetadata newScalar(String name, TypeProtos.MinorType type, TypeProtos.DataMode mode, boolean schemaForUnknown) -
newScalar
-
newDecimal
public static ColumnMetadata newDecimal(String name, TypeProtos.DataMode mode, int precision, int scale) -
newDecimal
public static ColumnMetadata newDecimal(String name, TypeProtos.MinorType type, TypeProtos.DataMode mode, int precision, int scale) -
isScalar
-
isScalar
-
isComplex
-
newDynamic
-
wildcard
-
isWildcard
-
cloneMapWithSchema
-
diffMap
-
diffTuple
-
hasDynamicColumns
-
isRepeatedList
-