You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Matt McCline (JIRA)" <ji...@apache.org> on 2014/10/13 04:25:34 UTC

[jira] [Commented] (HIVE-7373) Hive should not remove trailing zeros for decimal numbers

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

Matt McCline commented on HIVE-7373:
------------------------------------

I am investigating why vector_decimal_aggregate.q has a different output (extra trailing decimal zeroes for some query output values).  When you edit vector_decimal_aggregate.q to turn off vectorization and then re-run with it on, the outputs are different.

(The same is true for vector_decimal_cast.q, vector_decimal_math_funcs.q, etc)

I have looked at the patch #6 and it looks to me like this is point where outputs diverged...  That is, the divergence may have been caused by -Dtest.output.overwrite=true

> Hive should not remove trailing zeros for decimal numbers
> ---------------------------------------------------------
>
>                 Key: HIVE-7373
>                 URL: https://issues.apache.org/jira/browse/HIVE-7373
>             Project: Hive
>          Issue Type: Bug
>          Components: Types
>    Affects Versions: 0.13.0, 0.13.1
>            Reporter: Xuefu Zhang
>            Assignee: Sergio Peña
>              Labels: TODOC14
>             Fix For: 0.14.0
>
>         Attachments: HIVE-7373.1.patch, HIVE-7373.2.patch, HIVE-7373.3.patch, HIVE-7373.4.patch, HIVE-7373.5.patch, HIVE-7373.6.patch, HIVE-7373.6.patch
>
>
> Currently Hive blindly removes trailing zeros of a decimal input number as sort of standardization. This is questionable in theory and problematic in practice.
> 1. In decimal context,  number 3.140000 has a different semantic meaning from number 3.14. Removing trailing zeroes makes the meaning lost.
> 2. In a extreme case, 0.0 has (p, s) as (1, 1). Hive removes trailing zeros, and then the number becomes 0, which has (p, s) of (1, 0). Thus, for a decimal column of (1,1), input such as 0.0, 0.00, and so on becomes NULL because the column doesn't allow a decimal number with integer part.
> Therefore, I propose Hive preserve the trailing zeroes (up to what the scale allows). With this, in above example, 0.0, 0.00, and 0.0000 will be represented as 0.0 (precision=1, scale=1) internally.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)