Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-7373

Hive should not remove trailing zeros for decimal numbers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.13.0, 0.13.1
    • 0.14.0
    • Types
    • None

    Description

      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.

      Attachments

        1. HIVE-7373.6.patch
          107 kB
          Brock Noland
        2. HIVE-7373.6.patch
          107 kB
          Sergio Peña
        3. HIVE-7373.5.patch
          107 kB
          Sergio Peña
        4. HIVE-7373.4.patch
          109 kB
          Sergio Peña
        5. HIVE-7373.3.patch
          109 kB
          Sergio Peña
        6. HIVE-7373.2.patch
          110 kB
          Sergio Peña
        7. HIVE-7373.1.patch
          93 kB
          Sergio Peña

        Issue Links

          Activity

            People

              spena Sergio Peña
              xuefuz Xuefu Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: