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

Iurii Gerzhedovich updated IGNITE-20889:
----------------------------------------
    Epic Link: IGNITE-22700

> Sql. Change type derivation for literals and expressions for overflowed BIGINT
> ------------------------------------------------------------------------------
>
>                 Key: IGNITE-20889
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20889
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>    Affects Versions: 3.0.0-beta1
>            Reporter: Evgeny Stanilovsky
>            Priority: Major
>              Labels: ignite-3
>
> After [1] will be merged, it become possible to control overflow with numeric 
> operations, there are 3 places in code (will be notified under this issue) 
> which have been changed but seems it`s all due to partially incorrect 
> (calcite?) implementation. I spend a bit time and found that case with 
> overflowed BIGINT insertion: *ItDmlTest#testInsertValueOverflow* can be fixed 
> by correct implementing: *SqlNumericLiteral#createSqlType*, i fast check and 
> seems it will began work properly well, without additional code changes (all 
> core manipulations in scope of [1] can be reverted). The second case: 
> insertion for overflowed SUM of BIGINT  additional fix need to be done, 
> check: *SqlValidatorImpl#getValidatedNodeType*
> Further research is required here.
> [1] https://issues.apache.org/jira/browse/IGNITE-18662
> Just for note, for all above checks - i made dirty hack here: 
> IgniteSqlValidator#deriveType
> {code:java}
>         if (expr instanceof SqlNumericLiteral) {
>             SqlNumericLiteral expr0 = (SqlNumericLiteral) expr;
>             if (expr0.toValue().length() > 10 && expr0.getTypeName() == 
> SqlTypeName.DECIMAL) {
>                 return typeFactory.createSqlType(
>                         SqlTypeName.DECIMAL,
>                         requireNonNull(20, "prec"),
>                         0);
>             }
>         }
> {code}



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

Reply via email to