@Internal public final class LogicalTypeGeneralization extends Object
LogicalType
for a given set of types. If
such a type exists, all given types can be casted to this more general type.
This class aims to be compatible with the SQL standard. It is inspired by Apache Calcite's
SqlTypeFactoryImpl#leastRestrictive
method.
Modifier and Type | Method and Description |
---|---|
static Optional<LogicalType> |
findCommonType(List<LogicalType> types)
Returns the most common type of a set of types.
|
public static Optional<LogicalType> findCommonType(List<LogicalType> types)
For example: [INT, BIGINT, DECIMAL(2, 2)]
would lead to DECIMAL(21, 2)
.
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.