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

Lukas Lalinsky updated CALCITE-795:
-----------------------------------
    Description: 
When sending for example {code}{"type":"NUMBER","value":"333.333"}{code} to the 
"fetch" request of the remote JSON service, the exact value will not be kept 
and after one UPSERT/SELECT roundtrip in Phoenix I will get 333.332 back.

Interestingly enough, this worked in Calcite 1.2 before the TypedValue class 
was introduced, but I think that was working just by accident.

The attached patch changes the Jackson object mapper to decode any JSON float 
to BigDecimal, unless the code explicitly asks for Float/Double. I think that 
shouldn't break anything and it solves this problem.



  was:
When sending for example {code}{"type":"NUMBER","value":"333.333"}{code} to the 
"fetch" request of the remote JSON service, the exact value will not be kept 
and after one UPSERT/SELECT roundtrip in Phoenix I will get 333.332 back.

Interestingly enough, this worked in Calcite 1.2 before the TypedValue class 
was introduced, but I think that working just by accident.

The attached patch changes changes the Jackson object mapper to decode any JSON 
float to BigDecimal, unless the code explicitly asks for Float/Double. I think 
that shouldn't break anything and it solves this problem.




> Loss of precision when sending a decimal number via the remote JSON service
> ---------------------------------------------------------------------------
>
>                 Key: CALCITE-795
>                 URL: https://issues.apache.org/jira/browse/CALCITE-795
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Lukas Lalinsky
>            Assignee: Julian Hyde
>
> When sending for example {code}{"type":"NUMBER","value":"333.333"}{code} to 
> the "fetch" request of the remote JSON service, the exact value will not be 
> kept and after one UPSERT/SELECT roundtrip in Phoenix I will get 333.332 back.
> Interestingly enough, this worked in Calcite 1.2 before the TypedValue class 
> was introduced, but I think that was working just by accident.
> The attached patch changes the Jackson object mapper to decode any JSON float 
> to BigDecimal, unless the code explicitly asks for Float/Double. I think that 
> shouldn't break anything and it solves this problem.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to