[ 
https://issues.apache.org/jira/browse/IGNITE-18969?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-18969:
--------------------------------------
    Description: 
The current implement 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 possible to choose such, when type 
do 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}




  was:
The current implement 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 possible to choose such, when type 
do not have precision, etc).




> 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.0.0-beta2
>
>
> The current implement 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 possible to choose such, when 
> type do 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}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to