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

Inconsistent hehavior in decimal multiplication

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Types
    • None

    Description

      1. select cast('20' as decimal(38,18)) * cast('10' as decimal(38,18)) from test;
      returns 200, but the type of multiplication result is decimal (38,36) as shown in the query plan.
      2. select a*b from atable where column a and b with both column type of decimal (38,18) and column value 20 and 10 respectively, we get result NULL but type decimal (38, 36).

      If we strictly follow current precision/scale manipulations for the decimal multiplication in Hive, the result in case1 400 has already exceeded the data range that decimal (38, 36) supports and it should return null.
      Current Hive deduces the precision/scale from constant values (10 and 20) and use them (2, 0) instead of the specified precision/scale (38, 18) in the multiplication.

      Attachments

        Issue Links

          Activity

            People

              ctang Chaoyu Tang
              ctang Chaoyu Tang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: