@Internal public final class LogicalTypeChecks extends Object
LogicalType
and avoiding a lot of type casting and repetitive work.Modifier and Type | Method and Description |
---|---|
static boolean |
areTypesCompatible(LogicalType thisType,
LogicalType thatType)
Returns true if the two given types are compatible.
|
static int |
getDayPrecision(LogicalType logicalType) |
static int |
getFieldCount(LogicalType logicalType)
Returns the field count of row and structured types.
|
static int |
getFractionalPrecision(LogicalType logicalType) |
static int |
getLength(LogicalType logicalType) |
static int |
getPrecision(LogicalType logicalType)
Returns the precision of all types that define a precision implicitly or explicitly.
|
static int |
getScale(LogicalType logicalType)
Returns the scale of all types that define a scale implicitly or explicitly.
|
static int |
getYearPrecision(LogicalType logicalType) |
static boolean |
hasDayPrecision(LogicalType logicalType,
int yearPrecision) |
static boolean |
hasFamily(LogicalType logicalType,
LogicalTypeFamily family) |
static boolean |
hasFractionalPrecision(LogicalType logicalType,
int fractionalPrecision) |
static boolean |
hasLength(LogicalType logicalType,
int length) |
static boolean |
hasPrecision(LogicalType logicalType,
int precision)
Checks the precision of a type that defines a precision implicitly or explicitly.
|
static boolean |
hasRoot(LogicalType logicalType,
LogicalTypeRoot typeRoot) |
static boolean |
hasScale(LogicalType logicalType,
int scale)
Checks the scale of all types that define a scale implicitly or explicitly.
|
static boolean |
hasYearPrecision(LogicalType logicalType,
int yearPrecision) |
static boolean |
isCompositeType(LogicalType logicalType)
Checks if the given type is a composite type.
|
static boolean |
isProctimeAttribute(LogicalType logicalType) |
static boolean |
isRowtimeAttribute(LogicalType logicalType) |
static boolean |
isSingleFieldInterval(LogicalType logicalType) |
static boolean |
isTimeAttribute(LogicalType logicalType) |
public static boolean hasRoot(LogicalType logicalType, LogicalTypeRoot typeRoot)
public static boolean hasFamily(LogicalType logicalType, LogicalTypeFamily family)
public static boolean isTimeAttribute(LogicalType logicalType)
public static boolean isRowtimeAttribute(LogicalType logicalType)
public static boolean isProctimeAttribute(LogicalType logicalType)
public static boolean isCompositeType(LogicalType logicalType)
logicalType
- Logical data type to checkpublic static int getLength(LogicalType logicalType)
public static int getFieldCount(LogicalType logicalType)
public static boolean hasLength(LogicalType logicalType, int length)
public static int getPrecision(LogicalType logicalType)
public static boolean hasPrecision(LogicalType logicalType, int precision)
public static int getScale(LogicalType logicalType)
public static boolean hasScale(LogicalType logicalType, int scale)
public static int getYearPrecision(LogicalType logicalType)
public static boolean hasYearPrecision(LogicalType logicalType, int yearPrecision)
public static int getDayPrecision(LogicalType logicalType)
public static boolean hasDayPrecision(LogicalType logicalType, int yearPrecision)
public static int getFractionalPrecision(LogicalType logicalType)
public static boolean hasFractionalPrecision(LogicalType logicalType, int fractionalPrecision)
public static boolean isSingleFieldInterval(LogicalType logicalType)
public static boolean areTypesCompatible(LogicalType thisType, LogicalType thatType)
LogicalType.equals(Object)
),
for complex types (ARRAY, ROW, MAP, etc..), they must be in the same type but ignore field
names and other logical attributes, and all the children types (LogicalType.getChildren()
)
must be compatible too.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.