Class LogicalTypeChecks
java.lang.Object
org.apache.flink.table.types.logical.utils.LogicalTypeChecks
Utilities for checking
LogicalType and avoiding a lot of type casting and repetitive
work.-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareComparable(LogicalType firstType, LogicalType secondType, StructuredType.StructuredComparison requiredComparison) static booleancanBeTimeAttributeType(LogicalType logicalType) static intgetDayPrecision(LogicalType logicalType) static intgetFieldCount(LogicalType logicalType) Returns the field count of row and structured types.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 intgetFractionalPrecision(LogicalType logicalType) static intgetLength(LogicalType logicalType) static intgetPrecision(LogicalType logicalType) Returns the precision of all types that define a precision implicitly or explicitly.static intgetScale(LogicalType logicalType) Returns the scale of all types that define a scale implicitly or explicitly.static intgetYearPrecision(LogicalType logicalType) static booleanhasDayPrecision(LogicalType logicalType, int yearPrecision) static booleanhasFractionalPrecision(LogicalType logicalType, int fractionalPrecision) static booleanhasLegacyTypes(LogicalType logicalType) Checks whether a (possibly nested) logical type containsLegacyTypeInformationTypeorTypeInformationRawType.static booleanhasLength(LogicalType logicalType, int length) static booleanhasNested(LogicalType logicalType, Predicate<LogicalType> predicate) Checks whether a (possibly nested) logical type fulfills the given predicate.static booleanhasPrecision(LogicalType logicalType, int precision) Checks the precision of a type that defines a precision implicitly or explicitly.static booleanhasScale(LogicalType logicalType, int scale) Checks the scale of all types that define a scale implicitly or explicitly.static booleanhasWellDefinedString(LogicalType logicalType) Checks whether the givenLogicalTypehas a well-defined string representation when callingObject.toString()on the internal data structure.static booleanhasYearPrecision(LogicalType logicalType, int yearPrecision) static booleanisCompositeType(LogicalType logicalType) Checks if the given type is a composite type.static booleanisProctimeAttribute(LogicalType logicalType) static booleanisRowtimeAttribute(LogicalType logicalType) static booleanisSingleFieldInterval(LogicalType logicalType) static booleanisTimeAttribute(LogicalType logicalType)
-
Method Details
-
hasNested
Checks whether a (possibly nested) logical type fulfills the given predicate. -
hasLegacyTypes
Checks whether a (possibly nested) logical type containsLegacyTypeInformationTypeorTypeInformationRawType. -
isTimeAttribute
-
isRowtimeAttribute
-
isProctimeAttribute
-
canBeTimeAttributeType
-
isCompositeType
Checks if the given type is a composite type.Use
getFieldCount(LogicalType),getFieldNames(LogicalType),getFieldTypes(LogicalType)for unified handling of composite types.- Parameters:
logicalType- Logical data type to check- Returns:
- True if the type is composite type.
-
getLength
-
hasLength
-
getPrecision
Returns the precision of all types that define a precision implicitly or explicitly. -
hasPrecision
Checks the precision of a type that defines a precision implicitly or explicitly. -
getScale
Returns the scale of all types that define a scale implicitly or explicitly. -
hasScale
Checks the scale of all types that define a scale implicitly or explicitly. -
getYearPrecision
-
hasYearPrecision
-
getDayPrecision
-
hasDayPrecision
-
getFractionalPrecision
-
hasFractionalPrecision
-
isSingleFieldInterval
-
getFieldCount
Returns the field count of row and structured types. Other types return 1. -
getFieldNames
Returns the field names of row and structured types. -
getFieldTypes
Returns the field types of row and structured types. -
hasWellDefinedString
Checks whether the givenLogicalTypehas a well-defined string representation when callingObject.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.
-
areComparable
public static boolean areComparable(LogicalType firstType, LogicalType secondType, StructuredType.StructuredComparison requiredComparison)
-