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

Hive's type promotion isn't correct

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 0.10.0, 0.11.0, 0.12.0
    • None
    • None
    • None

    Description

      When dealing with union all, arithmetic operators, and other places when type promotion is needed or a common type is determined, Hive would promote non-exact data types (float and double) to HiveDecimal. However, HIveDecimal is an exact type. Promoting a non-exact type to an exact type makes a false impression to the user that the data is exact. For instance, expression 3.14 + 3.14BD produces an HiveDecimal number 6.28. However, the two are not equivalent, as the left operand is not exact. MySQL in this case produces a double 6.28, which is more reasonable.

      The problem was discovered in HIVE-3976. HIVE-5356 solves the problem for arithmetic operators, but there are more places where the problem exists. For instance, HIVE-5825 manifested the same issue.

      The purpose of this JIRA is to revisit the type casting and type promotion to make HIVE's behavior more in line with standard or other major database implementations.

      Attachments

        Issue Links

          Activity

            People

              xuefuz Xuefu Zhang
              xuefuz Xuefu Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: