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

Limit precision of decimal type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.11.0
    • None
    • None

    Description

      The current decimal implementation does not limit the precision of the numbers. This has a number of drawbacks. A maximum precision would allow us to:

      • Have SerDes/filformats store decimals more efficiently
      • Speed up processing by implementing operations w/o generating java BigDecimals
      • Simplify extending the datatype to allow for decimal(p) and decimal(p,s)
      • Write a more efficient BinarySortable SerDe for sorting/grouping/joining

      Exact numeric datatype are typically used to represent money, so if the limit is high enough it doesn't really become an issue.

      A typical representation would pack 9 decimal digits in 4 bytes. So, with 2 longs we can represent 36 digits - which is what I propose as the limit.

      Final thought: It's easier to restrict this now and have the option to do the things above than to try to do so once people start using the datatype.

      Attachments

        1. HIVE-4271.5.patch
          206 kB
          Gunther Hagleitner
        2. HIVE-4271.4.patch
          198 kB
          Gunther Hagleitner
        3. HIVE-4271.3.patch
          196 kB
          Gunther Hagleitner
        4. HIVE-4271.2.patch
          72 kB
          Gunther Hagleitner
        5. HIVE-4271.1.patch
          73 kB
          Gunther Hagleitner

        Issue Links

          Activity

            People

              hagleitn Gunther Hagleitner
              hagleitn Gunther Hagleitner
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: