@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 |
areComparable(LogicalType firstType,
LogicalType secondType,
StructuredType.StructuredComparison requiredComparison) |
static boolean |
canBeTimeAttributeType(LogicalType logicalType) |
static int |
getDayPrecision(LogicalType logicalType) |
static int |
getFieldCount(LogicalType logicalType)
Returns the field count of row and structured types.
|
static List<String> |
getFieldNames(LogicalType logicalType)
Returns the field names of row and structured types.
|
static List<LogicalType> |
getFieldTypes(LogicalType logicalType)
Returns the field types 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 |
hasFractionalPrecision(LogicalType logicalType,
int fractionalPrecision) |
static boolean |
hasLegacyTypes(LogicalType logicalType)
Checks whether a (possibly nested) logical type contains
LegacyTypeInformationType or
TypeInformationRawType . |
static boolean |
hasLength(LogicalType logicalType,
int length) |
static boolean |
hasNested(LogicalType logicalType,
Predicate<LogicalType> predicate)
Checks whether a (possibly nested) logical type fulfills the given predicate.
|
static boolean |
hasPrecision(LogicalType logicalType,
int precision)
Checks the precision of a type that defines a precision implicitly or explicitly.
|
static boolean |
hasScale(LogicalType logicalType,
int scale)
Checks the scale of all types that define a scale implicitly or explicitly.
|
static boolean |
hasWellDefinedString(LogicalType logicalType)
Checks whether the given
LogicalType has a well-defined string representation when
calling Object.toString() on the internal data structure. |
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 hasNested(LogicalType logicalType, Predicate<LogicalType> predicate)
public static boolean hasLegacyTypes(LogicalType logicalType)
LegacyTypeInformationType
or
TypeInformationRawType
.public static boolean isTimeAttribute(LogicalType logicalType)
public static boolean isRowtimeAttribute(LogicalType logicalType)
public static boolean isProctimeAttribute(LogicalType logicalType)
public static boolean canBeTimeAttributeType(LogicalType logicalType)
public static boolean isCompositeType(LogicalType logicalType)
Use getFieldCount(LogicalType)
, getFieldNames(LogicalType)
, getFieldTypes(LogicalType)
for unified handling of composite types.
logicalType
- Logical data type to checkpublic static int getLength(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 int getFieldCount(LogicalType logicalType)
public static List<String> getFieldNames(LogicalType logicalType)
public static List<LogicalType> getFieldTypes(LogicalType logicalType)
public static boolean hasWellDefinedString(LogicalType logicalType)
LogicalType
has a well-defined string representation when
calling Object.toString()
on the internal data structure. The string representation
would be similar in SQL or in a programming language.
Note: This method might not be necessary anymore, once we have implemented a utility that can convert any internal data structure to a well-defined string representation.
public static boolean areComparable(LogicalType firstType, LogicalType secondType, StructuredType.StructuredComparison requiredComparison)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.