public class Types extends Object
| Modifier and Type | Field and Description |
|---|---|
static TypeProtos.MajorType |
LATE_BIND_TYPE |
static int |
MAX_VARCHAR_LENGTH |
static TypeProtos.MajorType |
NULL |
static TypeProtos.MajorType |
OPTIONAL_BIT |
static TypeProtos.MajorType |
OPTIONAL_INT |
static TypeProtos.MajorType |
REQUIRED_BIT |
static int |
UNDEFINED |
| Constructor and Description |
|---|
Types() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areDecimalTypes(TypeProtos.MinorType... types)
Returns true if all specified types are decimal data types.
|
static TypeProtos.MajorType.Builder |
calculateTypePrecisionAndScale(TypeProtos.MajorType leftType,
TypeProtos.MajorType rightType,
TypeProtos.MajorType.Builder typeBuilder)
Sets max precision from both types if these types are string scalar types.
|
static String |
getBaseSqlTypeName(TypeProtos.MajorType type) |
static String |
getExtendedSqlTypeName(TypeProtos.MajorType type)
Extend decimal type with precision and scale.
|
static int |
getJdbcDisplaySize(TypeProtos.MajorType type) |
static int |
getJdbcTypeCode(String sqlTypeName)
Gets JDBC type code for given SQL data type name.
|
static TypeProtos.MajorType |
getMajorTypeFromName(String typeName) |
static TypeProtos.MajorType |
getMajorTypeFromName(String typeName,
TypeProtos.DataMode mode) |
static TypeProtos.MinorType |
getMinorTypeFromName(String typeName) |
static String |
getNameOfMinorType(TypeProtos.MinorType type) |
static int |
getPrecision(TypeProtos.MajorType majorType)
Get the
precision of given type. |
static int |
getScale(TypeProtos.MajorType majorType)
Get the
scale of given type. |
static String |
getSqlModeName(TypeProtos.MajorType type) |
static String |
getSqlTypeName(TypeProtos.MajorType type)
Gets SQL data type name for given Drill RPC-/protobuf-level data type.
|
static boolean |
isComplex(TypeProtos.MajorType type) |
static boolean |
isDateTimeType(TypeProtos.MajorType type) |
static boolean |
isDateTimeType(TypeProtos.MinorType type) |
static boolean |
isDecimalType(TypeProtos.MajorType type)
Returns true if specified type is decimal data type.
|
static boolean |
isDecimalType(TypeProtos.MinorType minorType)
Returns true if specified type is decimal data type.
|
static boolean |
isEquivalent(TypeProtos.MajorType type1,
TypeProtos.MajorType type2)
Requires full type equality, including fields such as precision and scale.
|
static boolean |
isFixedWidthType(TypeProtos.MajorType type) |
static boolean |
isFixedWidthType(TypeProtos.MinorType type) |
static boolean |
isIntervalType(TypeProtos.MajorType type) |
static boolean |
isIntervalType(TypeProtos.MinorType type) |
static boolean |
isJdbcSignedType(TypeProtos.MajorType type)
Reports whether given RPC-level type is a signed type (per semantics of
ResultSetMetaData.isSigned(int)). |
static boolean |
isNullable(TypeProtos.MajorType type) |
static boolean |
isNumericType(TypeProtos.MajorType type) |
static boolean |
isNumericType(TypeProtos.MinorType type) |
static boolean |
isRepeated(TypeProtos.MajorType type) |
static boolean |
isSameType(TypeProtos.MajorType type1,
TypeProtos.MajorType type2)
Check if two "core" types are the same, ignoring subtypes and
children.
|
static boolean |
isSameTypeAndMode(TypeProtos.MajorType first,
TypeProtos.MajorType second)
Check if two "core" types have the same minor type and data mode,
ignoring subtypes and children.
|
static boolean |
isScalarStringType(TypeProtos.MajorType type)
Checks if given major type is string scalar type.
|
static boolean |
isSortable(TypeProtos.MinorType type)
Checks if the given type column can be used in ORDER BY clause.
|
static boolean |
isUnion(TypeProtos.MajorType toType) |
static boolean |
isUntypedNull(TypeProtos.MajorType type) |
static boolean |
isVarWidthType(TypeProtos.MinorType type) |
static int |
maxPrecision(TypeProtos.MinorType type) |
static TypeProtos.MajorType |
optional(TypeProtos.MinorType type) |
static TypeProtos.MajorType |
overrideMode(TypeProtos.MajorType originalMajorType,
TypeProtos.DataMode overrideMode) |
static TypeProtos.MajorType |
repeated(TypeProtos.MinorType type) |
static TypeProtos.MajorType |
required(TypeProtos.MinorType type) |
static boolean |
softEquals(TypeProtos.MajorType a,
TypeProtos.MajorType b,
boolean allowNullSwap) |
static String |
toString(TypeProtos.MajorType type) |
static String |
typeKey(TypeProtos.MinorType type)
The union vector is a map of types.
|
static boolean |
usesHolderForGet(TypeProtos.MajorType type) |
static TypeProtos.MajorType |
withMode(TypeProtos.MinorType type,
TypeProtos.DataMode mode) |
static TypeProtos.MajorType |
withPrecision(TypeProtos.MinorType type,
TypeProtos.DataMode mode,
int precision)
Builds major type using given minor type, data mode and precision.
|
static TypeProtos.MajorType |
withPrecisionAndScale(TypeProtos.MinorType type,
TypeProtos.DataMode mode,
int precision,
int scale) |
public static final int MAX_VARCHAR_LENGTH
public static final int UNDEFINED
public static final TypeProtos.MajorType NULL
public static final TypeProtos.MajorType LATE_BIND_TYPE
public static final TypeProtos.MajorType REQUIRED_BIT
public static final TypeProtos.MajorType OPTIONAL_BIT
public static final TypeProtos.MajorType OPTIONAL_INT
public static boolean isUnion(TypeProtos.MajorType toType)
public static boolean isComplex(TypeProtos.MajorType type)
public static boolean isRepeated(TypeProtos.MajorType type)
public static boolean isNumericType(TypeProtos.MajorType type)
public static boolean isNumericType(TypeProtos.MinorType type)
public static boolean isDateTimeType(TypeProtos.MajorType type)
public static boolean isDateTimeType(TypeProtos.MinorType type)
public static boolean isIntervalType(TypeProtos.MajorType type)
public static boolean isIntervalType(TypeProtos.MinorType type)
public static boolean areDecimalTypes(TypeProtos.MinorType... types)
types - types to checkpublic static boolean isDecimalType(TypeProtos.MajorType type)
type - type to checkpublic static boolean isDecimalType(TypeProtos.MinorType minorType)
minorType - type to checkpublic static String getSqlTypeName(TypeProtos.MajorType type)
<data type>; what
INFORMATION_SCHEMA.COLUMNS.TYPE_NAME would list)public static String getBaseSqlTypeName(TypeProtos.MajorType type)
public static String getExtendedSqlTypeName(TypeProtos.MajorType type)
type - major typepublic static String getSqlModeName(TypeProtos.MajorType type)
public static int getJdbcTypeCode(String sqlTypeName)
public static boolean isJdbcSignedType(TypeProtos.MajorType type)
ResultSetMetaData.isSigned(int)).public static int getJdbcDisplaySize(TypeProtos.MajorType type)
public static boolean usesHolderForGet(TypeProtos.MajorType type)
public static boolean isFixedWidthType(TypeProtos.MajorType type)
public static boolean isFixedWidthType(TypeProtos.MinorType type)
public static boolean isVarWidthType(TypeProtos.MinorType type)
public static boolean isScalarStringType(TypeProtos.MajorType type)
type - major typepublic static boolean softEquals(TypeProtos.MajorType a, TypeProtos.MajorType b, boolean allowNullSwap)
public static boolean isUntypedNull(TypeProtos.MajorType type)
public static TypeProtos.MajorType withMode(TypeProtos.MinorType type, TypeProtos.DataMode mode)
public static TypeProtos.MajorType withPrecision(TypeProtos.MinorType type, TypeProtos.DataMode mode, int precision)
type - minor typemode - data modeprecision - precision valuepublic static TypeProtos.MajorType withPrecisionAndScale(TypeProtos.MinorType type, TypeProtos.DataMode mode, int precision, int scale)
public static TypeProtos.MajorType required(TypeProtos.MinorType type)
public static TypeProtos.MajorType repeated(TypeProtos.MinorType type)
public static TypeProtos.MajorType optional(TypeProtos.MinorType type)
public static TypeProtos.MajorType overrideMode(TypeProtos.MajorType originalMajorType, TypeProtos.DataMode overrideMode)
public static TypeProtos.MajorType getMajorTypeFromName(String typeName)
public static TypeProtos.MinorType getMinorTypeFromName(String typeName)
public static TypeProtos.MajorType getMajorTypeFromName(String typeName, TypeProtos.DataMode mode)
public static String getNameOfMinorType(TypeProtos.MinorType type)
public static String toString(TypeProtos.MajorType type)
public static int getPrecision(TypeProtos.MajorType majorType)
precision of given type.majorType - major typepublic static int getScale(TypeProtos.MajorType majorType)
scale of given type.majorType - major typepublic static boolean isSortable(TypeProtos.MinorType type)
type - minor typepublic static TypeProtos.MajorType.Builder calculateTypePrecisionAndScale(TypeProtos.MajorType leftType, TypeProtos.MajorType rightType, TypeProtos.MajorType.Builder typeBuilder)
leftType - type from left siderightType - type from right sidetypeBuilder - type builderpublic static boolean isSameType(TypeProtos.MajorType type1, TypeProtos.MajorType type2)
type1 - first typetype2 - second typepublic static boolean isSameTypeAndMode(TypeProtos.MajorType first, TypeProtos.MajorType second)
first - first type to checksecond - second type to checktrue if the two types have the same minor type and mode,
false otherwisepublic static boolean isEquivalent(TypeProtos.MajorType type1, TypeProtos.MajorType type2)
public static String typeKey(TypeProtos.MinorType type)
type - Drill data typepublic static int maxPrecision(TypeProtos.MinorType type)
public static boolean isNullable(TypeProtos.MajorType type)
Copyright © 2021 The Apache Software Foundation. All rights reserved.