You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Vitalii Diravka (JIRA)" <ji...@apache.org> on 2018/04/12 16:51:00 UTC

[jira] [Commented] (DRILL-6094) Decimal data type enhancements

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

Vitalii Diravka commented on DRILL-6094:
----------------------------------------

Looks like ARROW-61 is not an issue for Drill anymore.
 Drill 1.6.0 version:
{code:java}
SELECT CAST('922337203685477587' as DECIMAL(18, 0)) > CAST('0.1' as DECIMAL(18, 1)) IS_FIRST_GREATER FROM (VALUES(1))
--------------------------------------
| IS_FIRST_GREATER<BIT(REQUIRED)>    |
--------------------------------------
| false                              |
--------------------------------------

select _DECIMAL_decimal18 > _DECIMAL_decimal18_2 GREATER_THAN, _DECIMAL_decimal18, _DECIMAL_decimal18_2 from dfs.`/tmp/parquet/drill/parquet_test_file_simple` t
----------------------------------------------------------------------------------------------------------------
| GREATER_THAN<BIT(REQUIRED)>        | _DECIMAL_decimal18<DECIMAL18(REQUI | _DECIMAL_decimal18_2<DECIMAL18(REQ |
----------------------------------------------------------------------------------------------------------------
| false                              | 922337203685477587                 | 0.1                                |
----------------------------------------------------------------------------------------------------------------
{code}
Current Drill master:
{code:java}
SELECT CAST('922337203685477587' as DECIMAL(18, 0)) > CAST('0.1' as DECIMAL(18, 1)) IS_FIRST_GREATER FROM (VALUES(1))
----------------------------------------------------------------------------------------------------------------
IS_FIRST_GREATER<BIT(REQUIRED)>
true

select _DECIMAL_decimal18 > _DECIMAL_decimal18_2 IS_FIRST_GREATER, _DECIMAL_decimal18, _DECIMAL_decimal18_2" +
          " from dfs.root.`/tmp/parquet/drill/parquet_test_file_simple` t
----------------------------------------------------------------------------------------------------------------
IS_FIRST_GREATER<BIT(REQUIRED)>,_DECIMAL_decimal18<DECIMAL18(REQUIRED)>,_DECIMAL_decimal18_2<DECIMAL18(REQUIRED)>
true,922337203685477587,0.1
{code}
For the first query Calcite simplifies the predicaste in the project to true and for the second query casting to FLOAT8 is used now (and FLOAT8 values are compared).

Therefore _adjustScaleMultiply_ is still buggy and isn't needed anymore (after moving to VARDECIMAL) I recommend to remove it from the project.

> Decimal data type enhancements
> ------------------------------
>
>                 Key: DRILL-6094
>                 URL: https://issues.apache.org/jira/browse/DRILL-6094
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.12.0
>            Reporter: Volodymyr Vysotskyi
>            Assignee: Volodymyr Vysotskyi
>            Priority: Major
>
> Currently, Decimal types are disabled by default since existing Decimal implementation has a lot of flaws and performance problems. The goal of this Jira to describe majority of them and possible ways of improving existing implementation to be able to enable Decimal data types by default.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)