You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by "Mehant Baid (JIRA)" <ji...@apache.org> on 2014/04/30 08:14:15 UTC

[jira] [Commented] (DRILL-588) decimal type treats decimal point as a significant digit

    [ https://issues.apache.org/jira/browse/DRILL-588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13985212#comment-13985212 ] 

Mehant Baid commented on DRILL-588:
-----------------------------------

We don't count the decimal point as a digit. Scale mentioned here is 9. So we will have a total of 9 scale digits + 1 integer digit (in this case integer digit is 0) so string parser raises an error to indicate there are 10 digits. The bug is in the string parser logic and it should take into account if the integer digit is 0 and not count it as a digit. 

> decimal type treats decimal point as a significant digit
> --------------------------------------------------------
>
>                 Key: DRILL-588
>                 URL: https://issues.apache.org/jira/browse/DRILL-588
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Chun Chang
>
> convert a 0.00000001 as decimal(9,9) fails. I think we count the decimal point as a significant digit which is wrong.
> 0: jdbc:drill:schema=dfs> select cast(c_decimal9 as decimal(9,9)) from data where c_row = 6;
> Query failed: org.apache.drill.exec.rpc.RpcException: Remote failure while running query.[error_id: "6cbc059b-2001-4ca5-95dc-729dc5226836"
> endpoint {
>   address: "qa-node118.qa.lab"
>   user_port: 31010
>   control_port: 31011
>   data_port: 31012
> }
> error_type: 0
> message: "Failure while running fragment. < DrillRuntimeException:[ Precision is insufficient for the provided input: 0.00000001 Precision: 9 Total Digits: 10 ]"
> ]
> Error: exception while executing query (state=,code=0)
> cast it to varchar shows the correct value.
> 0: jdbc:drill:schema=dfs> select cast(c_decimal9 as varchar(10)) from data where c_row = 6;
> +------------+
> |   EXPR$0   |
> +------------+
> | 0.00000001 |
> +------------+
> 1 row selected (0.141 seconds)



--
This message was sent by Atlassian JIRA
(v6.2#6252)