You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Yu Xu (Jira)" <ji...@apache.org> on 2026/10/18 10:40:00 UTC

[jira] [Assigned] (CALCITE-4531) Deprecate RexLiteral#intValue since it performs silent truncation

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

Yu Xu reassigned CALCITE-4531:
------------------------------

    Assignee: Yu Xu

> Deprecate RexLiteral#intValue since it performs silent truncation
> -----------------------------------------------------------------
>
>                 Key: CALCITE-4531
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4531
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Vladimir Sitnikov
>            Assignee: Yu Xu
>            Priority: Critical
>
> {{RexLiteral#intValue}} is prone to errors since it silently truncates values to {{int}} so the developers might fail to know that at the compile time.
> It might be safer to expose {{BigDecimal}} or {{intValueExact}} or {{doubleValue}} alternatives which would be "enough for all the possible cases".
> An alternative option is to mark the method as deprecated, so every use of the method would require users to suppress the warning, so they know why the method is deprecated.
> I guess the most common use case for {{RexLiteral.intValue}} is {{offset}} and {{fetch}} in {{Sort}}, however, the misuse is hard to spot, and it might result in hard to notice data corruptions.



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