@Internal public final class LogicalTypeMerging extends Object
LogicalType
.Modifier and Type | Method and Description |
---|---|
static DecimalType |
findAdditionDecimalType(int precision1,
int scale1,
int precision2,
int scale2)
Finds the result type of a decimal addition operation.
|
static LogicalType |
findAvgAggType(LogicalType argType)
Finds the result type of a decimal average aggregation.
|
static Optional<LogicalType> |
findCommonType(List<LogicalType> types)
Returns the most common, more general
LogicalType for a given set of types. |
static DecimalType |
findDivisionDecimalType(int precision1,
int scale1,
int precision2,
int scale2)
Finds the result type of a decimal division operation.
|
static DecimalType |
findModuloDecimalType(int precision1,
int scale1,
int precision2,
int scale2)
Finds the result type of a decimal modulo operation.
|
static DecimalType |
findMultiplicationDecimalType(int precision1,
int scale1,
int precision2,
int scale2)
Finds the result type of a decimal multiplication operation.
|
static DecimalType |
findRoundDecimalType(int precision,
int scale,
int round)
Finds the result type of a decimal rounding operation.
|
static LogicalType |
findSumAggType(LogicalType argType)
Finds the result type of a decimal sum aggregation.
|
public static Optional<LogicalType> findCommonType(List<LogicalType> types)
LogicalType
for 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 to DECIMAL(21, 2)
.
This class aims to be compatible with the SQL standard. It is inspired by Apache Calcite's
SqlTypeFactoryImpl#leastRestrictive
method.
public static DecimalType findDivisionDecimalType(int precision1, int scale1, int precision2, int scale2)
public static DecimalType findModuloDecimalType(int precision1, int scale1, int precision2, int scale2)
public static DecimalType findMultiplicationDecimalType(int precision1, int scale1, int precision2, int scale2)
public static DecimalType findAdditionDecimalType(int precision1, int scale1, int precision2, int scale2)
public static DecimalType findRoundDecimalType(int precision, int scale, int round)
public static LogicalType findAvgAggType(LogicalType argType)
public static LogicalType findSumAggType(LogicalType argType)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.