[
https://issues.apache.org/jira/browse/IGNITE-18969?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Evgeny Stanilovsky updated IGNITE-18969:
----------------------------------------
Fix Version/s: 3.2
(was: 3.1)
> Sql. Implement of leastRestrictiveType for custom data types within the same
> type family.
> -----------------------------------------------------------------------------------------
>
> Key: IGNITE-18969
> URL: https://issues.apache.org/jira/browse/IGNITE-18969
> Project: Ignite
> Issue Type: Improvement
> Components: sql
> Reporter: Maksim Zhuravkov
> Priority: Minor
> Labels: calcite3-required, ignite-3
> Fix For: 3.2
>
>
> The current implementation of IgniteTypeFactory::leastRestrictiveType returns
> the first custom data type it encounters, which is obviously not correct.
> Add generic rules on how `leastRestrictiveType` should work for some custom
> data type (e.g. when a type has precision it is possible to choose such, when
> type does not have precision, etc).
> {code:java}
> var type1 = TYPE_FACTORY.createSqlType(SqlTypeName.VARCHAR, 10);
> var type2 = TYPE_FACTORY.createSqlType(SqlTypeName.VARCHAR, 20);
> var actualType = TYPE_FACTORY.leastRestrictive(Arrays.asList(type1, type2));
> // prints VARCHAR(20)
> System.out.println(actualType);
> {code}
> Javadoc on RelDataTypeFactory::leastRestrictiveType:
> {code:java}
> Returns the most general of a set of types (that is, one type to which they
> can all be cast), or null if conversion is not possible. The result may be a
> new type that is less restrictive than any of the input types, e.g.
> leastRestrictive(INT, NUMERIC(3, 2)) could be NUMERIC(12, 2).
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)