hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xuefu Zhang (JIRA)" <>
Subject [jira] [Commented] (HIVE-7373) Hive should not remove trailing zeros for decimal numbers
Date Mon, 28 Jul 2014 16:38:38 GMT


Xuefu Zhang commented on HIVE-7373:

What's the desired behavior then? If we have a field that says it holds values that are decimal(5,4),
should someone including a 0.0 get a NULL or an implicit cast?

decimal(5,4) is perfectly okay to hold 0.0, which has precision of 1 and scale of 1. Maybe
I misunderstood the question.

> Hive should not remove trailing zeros for decimal numbers
> ---------------------------------------------------------
>                 Key: HIVE-7373
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: Types
>    Affects Versions: 0.13.0, 0.13.1
>            Reporter: Xuefu Zhang
>            Assignee: Xuefu Zhang
> 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

View raw message