[teiid-issues] [JBoss JIRA] (TEIID-4269) numeric calculated fields not displayed with odata4

Ramesh Reddy (JIRA) issues at jboss.org
Tue Jul 5 15:27:00 EDT 2016


    [ https://issues.jboss.org/browse/TEIID-4269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13261983#comment-13261983 ] 

Ramesh Reddy commented on TEIID-4269:
-------------------------------------

A expression in Teiid yields 
{code}
convert(convert(539568, double)/106, bigdecimal(13,3))
{code}

5090.264150943396

so here if the data is being computed,  IMO "convert" is not converting the result to 5090.264 to match what is defined or if view is defined with column as bigdecimal (13,3) computed value is not being implicitly converted to defined scale.

I am not sure what is the solution?

> numeric calculated fields not displayed with odata4
> ---------------------------------------------------
>
>                 Key: TEIID-4269
>                 URL: https://issues.jboss.org/browse/TEIID-4269
>             Project: Teiid
>          Issue Type: Bug
>          Components: OData
>    Affects Versions: 8.13.3
>            Reporter: Mirco Marchitiello
>            Assignee: Ramesh Reddy
>            Priority: Minor
>
> I've created a virtual table with a new field defined in this way:
> select ROUND((BA.PREIS / BA.PEINH), 3) AS UnitPrice from xxxxxx
> for the source field are bigdecimal I define UnitPrice as
> BigDecimal (13,3)
> If I run the qery from JDBC
> select * from PurchaseRequisitionEntity where PurchaseRequisitionKey = '300-8000001452-00010' ;
> PREIS = 539,568
> PEINH = 106
> UnitPrice = 5,090.264
> And the result is correct. If I run from odata2
> /odata/CASALE.1/Entities.PurchaseRequisitionEntity('300-8000001452-00010')?$format=json
> "UnitPrice" : "5090.2640000000000000"
> As you can see the field is rounded to the 3rd digit but 13 more digits are returned with 0 value.
> Anyway odata2 succeeds in returning the result without errors.
> With odata4 I get an error:
> /odata4/CASALE.1/Entities/PurchaseRequisitionEntity('300-8000001452-00010')?$format=json
> {"error":{"code":null,"message":"The value '5090.2640000000000000' is not valid for property 'UnitPrice'."}}
> I think that's because the length of the field is greater then the matedata definition.
> At the moment the only solution I can imagine is to convert the number to a string in the proper format and the parse it into a number



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the teiid-issues mailing list