Class LogicalTypeMerging
java.lang.Object
org.apache.flink.table.types.logical.utils.LogicalTypeMerging
Utilities for merging multiple
LogicalType.-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 Details
-
findCommonType
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
Finds the result type of a decimal rounding operation. -
findAvgAggType
Finds the result type of a decimal average aggregation. -
findSumAggType
Finds the result type of a decimal sum aggregation.
-