public class TypeDescription extends Object implements Comparable<TypeDescription>, Serializable, Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
TypeDescription.Category |
static class |
TypeDescription.RowBatchVersion
Specify the version of the VectorizedRowBatch that the user desires.
|
Modifier and Type | Field and Description |
---|---|
static String |
ENCRYPT_ATTRIBUTE |
static String |
MASK_ATTRIBUTE |
static long |
MAX_DECIMAL64 |
static int |
MAX_DECIMAL64_PRECISION |
static long |
MIN_DECIMAL64 |
Constructor and Description |
---|
TypeDescription(TypeDescription.Category category) |
Modifier and Type | Method and Description |
---|---|
void |
addChild(TypeDescription child)
Add a child to a type.
|
TypeDescription |
addField(String field,
TypeDescription fieldType)
Add a field to a struct type as it is built.
|
TypeDescription |
addUnionChild(TypeDescription child)
Add a child to a union type.
|
void |
annotateEncryption(String encryption,
String masks)
Annotate a schema with the encryption keys and masks.
|
TypeDescription |
clone() |
int |
compareTo(TypeDescription other) |
static TypeDescription |
createBinary() |
static TypeDescription |
createBoolean() |
static TypeDescription |
createByte() |
static TypeDescription |
createChar() |
static TypeDescription |
createDate() |
static TypeDescription |
createDecimal() |
static TypeDescription |
createDouble() |
static TypeDescription |
createFloat() |
static TypeDescription |
createInt() |
static TypeDescription |
createList(TypeDescription childType) |
static TypeDescription |
createLong() |
static TypeDescription |
createMap(TypeDescription keyType,
TypeDescription valueType) |
VectorizedRowBatch |
createRowBatch()
Create a VectorizedRowBatch with the original ColumnVector types
|
VectorizedRowBatch |
createRowBatch(int maxSize)
Create a VectorizedRowBatch with the original ColumnVector types
|
VectorizedRowBatch |
createRowBatch(TypeDescription.RowBatchVersion version,
int size) |
VectorizedRowBatch |
createRowBatchV2()
Create a VectorizedRowBatch that uses Decimal64ColumnVector for
short (p ≤ 18) decimals.
|
static TypeDescription |
createShort() |
static TypeDescription |
createString() |
static TypeDescription |
createStruct() |
static TypeDescription |
createTimestamp() |
static TypeDescription |
createTimestampInstant() |
static TypeDescription |
createUnion() |
static TypeDescription |
createVarchar() |
boolean |
equals(Object other) |
boolean |
equals(Object other,
boolean checkAttributes)
Determines whether the two object are equal.
|
TypeDescription |
findSubtype(int goal)
Locate a subtype by its id.
|
TypeDescription |
findSubtype(String columnName)
Find a subtype of this schema by name.
|
TypeDescription |
findSubtype(String columnName,
boolean isSchemaEvolutionCaseAware) |
List<TypeDescription> |
findSubtypes(String columnNameList)
Find a list of subtypes from a string, including the empty list.
|
static TypeDescription |
fromString(String typeName)
Parse TypeDescription from the Hive type names.
|
List<String> |
getAttributeNames()
Get the list of attribute names defined on this type.
|
String |
getAttributeValue(String attributeName)
Get the value of a given attribute.
|
TypeDescription.Category |
getCategory()
Get the kind of this type.
|
List<TypeDescription> |
getChildren()
Get the subtypes of this type.
|
List<String> |
getFieldNames()
For struct types, get the list of field names.
|
int |
getId()
Get the id for this type.
|
int |
getMaximumId()
Get the maximum id assigned to this type or its children.
|
int |
getMaxLength()
Get the maximum length of the type.
|
int |
getPrecision()
Get the precision of the decimal type.
|
int |
getScale()
Get the scale of the decimal type.
|
int |
hashCode() |
void |
printToBuffer(StringBuilder buffer) |
TypeDescription |
removeAttribute(@NotNull String key)
Remove attribute on this type, if it is set.
|
TypeDescription |
setAttribute(@NotNull String key,
@NotNull String value)
Set an attribute on this type.
|
String |
toJson() |
String |
toString() |
TypeDescription |
withMaxLength(int maxLength)
Set the maximum length for char and varchar types.
|
TypeDescription |
withPrecision(int precision)
For decimal types, set the precision.
|
TypeDescription |
withScale(int scale)
For decimal types, set the scale.
|
public static final int MAX_DECIMAL64_PRECISION
public static final long MAX_DECIMAL64
public static final long MIN_DECIMAL64
public static final String ENCRYPT_ATTRIBUTE
public static final String MASK_ATTRIBUTE
public TypeDescription(TypeDescription.Category category)
public int compareTo(TypeDescription other)
compareTo
in interface Comparable<TypeDescription>
public static TypeDescription createBoolean()
public static TypeDescription createByte()
public static TypeDescription createShort()
public static TypeDescription createInt()
public static TypeDescription createLong()
public static TypeDescription createFloat()
public static TypeDescription createDouble()
public static TypeDescription createString()
public static TypeDescription createDate()
public static TypeDescription createTimestamp()
public static TypeDescription createTimestampInstant()
public static TypeDescription createBinary()
public static TypeDescription createDecimal()
public static TypeDescription fromString(String typeName)
typeName
- the name of the typeIllegalArgumentException
- if the string is badly formedpublic TypeDescription withPrecision(int precision)
precision
- the new precisionpublic TypeDescription withScale(int scale)
scale
- the new scalepublic TypeDescription setAttribute(@NotNull @NotNull String key, @NotNull @NotNull String value)
key
- the attribute namevalue
- the attribute value or null to clear the valuepublic TypeDescription removeAttribute(@NotNull @NotNull String key)
key
- the attribute namepublic static TypeDescription createVarchar()
public static TypeDescription createChar()
public TypeDescription withMaxLength(int maxLength)
maxLength
- the maximum valuepublic static TypeDescription createList(TypeDescription childType)
public static TypeDescription createMap(TypeDescription keyType, TypeDescription valueType)
public static TypeDescription createUnion()
public static TypeDescription createStruct()
public TypeDescription addUnionChild(TypeDescription child)
child
- a new child type to addpublic TypeDescription addField(String field, TypeDescription fieldType)
field
- the field namefieldType
- the type of the fieldpublic int getId()
public TypeDescription clone()
public boolean equals(Object other, boolean checkAttributes)
other
- the reference object with which to compare.checkAttributes
- should the type attributes be considered?true
if this object is the same as the other
argument; false
otherwise.public int getMaximumId()
public VectorizedRowBatch createRowBatch(TypeDescription.RowBatchVersion version, int size)
public VectorizedRowBatch createRowBatchV2()
public VectorizedRowBatch createRowBatch(int maxSize)
maxSize
- the maximum size of the batchpublic VectorizedRowBatch createRowBatch()
public TypeDescription.Category getCategory()
public int getMaxLength()
public int getPrecision()
public int getScale()
public List<String> getFieldNames()
public List<String> getAttributeNames()
public String getAttributeValue(String attributeName)
attributeName
- the name of the attributepublic List<TypeDescription> getChildren()
public void addChild(TypeDescription child)
child
- the child to addpublic void printToBuffer(StringBuilder buffer)
public String toJson()
public TypeDescription findSubtype(int goal)
goal
- the column id to look forpublic TypeDescription findSubtype(String columnName)
columnName
- the name to search forpublic TypeDescription findSubtype(String columnName, boolean isSchemaEvolutionCaseAware)
public List<TypeDescription> findSubtypes(String columnNameList)
columnNameList
- the list of column namesCopyright © 2013–2021 The Apache Software Foundation. All rights reserved.