You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Oliver Lee (Jira)" <ji...@apache.org> on 2024/10/31 23:57:00 UTC

[jira] [Created] (CALCITE-6662) RelJson.rangePointFromJson cannot create Double numerics

Oliver Lee created CALCITE-6662:
-----------------------------------

             Summary: RelJson.rangePointFromJson cannot create Double numerics
                 Key: CALCITE-6662
                 URL: https://issues.apache.org/jira/browse/CALCITE-6662
             Project: Calcite
          Issue Type: Task
            Reporter: Oliver Lee


Following CALCITE-2067, RexLiteral has more accurate validation between using exact numerics vs approximate numerics to create RexLiterals. 

[RelJson.rangeEndPointFromJson|https://github.com/apache/calcite/blob/2e99d5118efbba21c87e7da08b8359ce296e138d/core/src/main/java/org/apache/calcite/rel/externalize/RelJson.java#L940] however only creates all numerics using BigDecimal, and this causes errors to be thrown when deserializing rel jsons  [here|https://github.com/apache/calcite/blob/2e99d5118efbba21c87e7da08b8359ce296e138d/core/src/main/java/org/apache/calcite/rex/RexLiteral.java#L234]. 

 

I believe the fix would be to allow rangeEndPointFromJson to attempt to cast to `Double` first, check if it is the same value prior to casting, otherwise continue to cast as BigDecimal, which we use for exact numerics.



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