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)

Reply via email to