You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by "Chun Chang (JIRA)" <ji...@apache.org> on 2014/04/29 19:58:31 UTC

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

Chun Chang created DRILL-588:
--------------------------------

             Summary: 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)