You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Toivo Adams <to...@gmail.com> on 2016/05/06 18:14:11 UTC

Is decimal or numeric data type also supported?

Hi

Is decimal or numeric data type also supported?
Input, CSV file:

ID:int,AMOUNT1:float,AMOUNT2:float,AMOUNT3:float
008, 10.05, 15.45, 89.99
100, 20.05, 25.05, 45.05
200, 34.05, 25.05, 75.05

select ID, AMOUNT1+AMOUNT2+AMOUNT3 as TOTAL from CSV.A where ID=100

result:
ID      TOTAL
100  90.149994

Double and Float types are not precise.
Any way to use Decimal type?

Thanks
toivo

Re: Is decimal or numeric data type also supported?

Posted by Toivo Adams <to...@gmail.com>.
https://issues.apache.org/jira/browse/CALCITE-1231

2016-05-06 21:32 GMT+03:00 Julian Hyde <jh...@apache.org>:

> enum CsvFieldType does not include a decimal or numeric type right now.
> Feel free to log a JIRA case. A workaround might be to keep the data as
> strings then cast explicitly to decimal.
>
> > On May 6, 2016, at 11:14 AM, Toivo Adams <to...@gmail.com> wrote:
> >
> > Hi
> >
> > Is decimal or numeric data type also supported?
> > Input, CSV file:
> >
> > ID:int,AMOUNT1:float,AMOUNT2:float,AMOUNT3:float
> > 008, 10.05, 15.45, 89.99
> > 100, 20.05, 25.05, 45.05
> > 200, 34.05, 25.05, 75.05
> >
> > select ID, AMOUNT1+AMOUNT2+AMOUNT3 as TOTAL from CSV.A where ID=100
> >
> > result:
> > ID      TOTAL
> > 100  90.149994
> >
> > Double and Float types are not precise.
> > Any way to use Decimal type?
> >
> > Thanks
> > toivo
>
>

Re: Is decimal or numeric data type also supported?

Posted by Julian Hyde <jh...@apache.org>.
enum CsvFieldType does not include a decimal or numeric type right now. Feel free to log a JIRA case. A workaround might be to keep the data as strings then cast explicitly to decimal.

> On May 6, 2016, at 11:14 AM, Toivo Adams <to...@gmail.com> wrote:
> 
> Hi
> 
> Is decimal or numeric data type also supported?
> Input, CSV file:
> 
> ID:int,AMOUNT1:float,AMOUNT2:float,AMOUNT3:float
> 008, 10.05, 15.45, 89.99
> 100, 20.05, 25.05, 45.05
> 200, 34.05, 25.05, 75.05
> 
> select ID, AMOUNT1+AMOUNT2+AMOUNT3 as TOTAL from CSV.A where ID=100
> 
> result:
> ID      TOTAL
> 100  90.149994
> 
> Double and Float types are not precise.
> Any way to use Decimal type?
> 
> Thanks
> toivo