Class LogicalTypeMerging
- java.lang.Object
-
- org.apache.flink.table.types.logical.utils.LogicalTypeMerging
-
@Internal public final class LogicalTypeMerging extends Object
Utilities for merging multipleLogicalType.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DecimalTypefindAdditionDecimalType(int precision1, int scale1, int precision2, int scale2)Finds the result type of a decimal addition operation.static LogicalTypefindAvgAggType(LogicalType argType)Finds the result type of a decimal average aggregation.static Optional<LogicalType>findCommonType(List<LogicalType> types)Returns the most common, more generalLogicalTypefor a given set of types.static DecimalTypefindDivisionDecimalType(int precision1, int scale1, int precision2, int scale2)Finds the result type of a decimal division operation.static DecimalTypefindModuloDecimalType(int precision1, int scale1, int precision2, int scale2)Finds the result type of a decimal modulo operation.static DecimalTypefindMultiplicationDecimalType(int precision1, int scale1, int precision2, int scale2)Finds the result type of a decimal multiplication operation.static DecimalTypefindRoundDecimalType(int precision, int scale, int round)Finds the result type of a decimal rounding operation.static LogicalTypefindSumAggType(LogicalType argType)Finds the result type of a decimal sum aggregation.
-
-
-
Method Detail
-
findCommonType
public static Optional<LogicalType> findCommonType(List<LogicalType> types)
Returns the most common, more generalLogicalTypefor a given set of types. If such a type exists, all given types can be casted to this more general type.For example:
[INT, BIGINT, DECIMAL(2, 2)]would lead toDECIMAL(21, 2).This class aims to be compatible with the SQL standard. It is inspired by Apache Calcite's
SqlTypeFactoryImpl#leastRestrictivemethod.
-
findDivisionDecimalType
public static DecimalType findDivisionDecimalType(int precision1, int scale1, int precision2, int scale2)
Finds the result type of a decimal division operation.
-
findModuloDecimalType
public static DecimalType findModuloDecimalType(int precision1, int scale1, int precision2, int scale2)
Finds the result type of a decimal modulo operation.
-
findMultiplicationDecimalType
public static DecimalType findMultiplicationDecimalType(int precision1, int scale1, int precision2, int scale2)
Finds the result type of a decimal multiplication operation.
-
findAdditionDecimalType
public static DecimalType findAdditionDecimalType(int precision1, int scale1, int precision2, int scale2)
Finds the result type of a decimal addition operation.
-
findRoundDecimalType
public static DecimalType findRoundDecimalType(int precision, int scale, int round)
Finds the result type of a decimal rounding operation.
-
findAvgAggType
public static LogicalType findAvgAggType(LogicalType argType)
Finds the result type of a decimal average aggregation.
-
findSumAggType
public static LogicalType findSumAggType(LogicalType argType)
Finds the result type of a decimal sum aggregation.
-
-