Hive
  1. Hive
  2. HIVE-5726

The DecimalTypeInfo instance associated with a decimal constant is not in line with the precision/scale of the constant

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.13.0
    • Component/s: None
    • Labels:
      None

      Description

      Currently Hive uses a default decimal type info instance to associate with a decimal constant in the expression tree. To precisely determine the precision/scale of the expression result requires more accurate precision/scale of the type of the decimal constant. Thus, Hive uses a precision/scale of the constant for the type info instance. As an example, the following is not desirable:

      hive> create table mytable as select 3.14BD as t from person_age limit 1;
      hive> desc mytable;
      OK
      t                   	decimal(65,30)      	None                
      Time taken: 0.08 seconds, Fetched: 1 row(s)
      

      instead, the precision/scale for t above should be (3, 2).

      1. HIVE-5726.patch
        4 kB
        Xuefu Zhang
      2. HIVE-5726.2.patch
        7 kB
        Xuefu Zhang
      3. HIVE-5726.1.patch
        6 kB
        Xuefu Zhang

        Issue Links

          Activity

          Xuefu Zhang created issue -
          Xuefu Zhang made changes -
          Field Original Value New Value
          Description Currently Hive uses a default decimal type info instance to associate with a decimal constant in the expression tree. To precisely determine the precision/scale of the expression result requires more accurate precision/scale of the type of the decimal constant. Thus, Hive uses a precision/scale of the constant for the type info instance. As an example, the following is not desirable:
          {code}
          hive> create table mytable as select 3.14BD as t from person_age limit 1;
          hive> desc mytable;
          OK
          t decimal(65,30) None
          Time taken: 0.08 seconds, Fetched: 1 row(s)
          {code}

          instead, the precision/scale for t above should be (3.2).
          Currently Hive uses a default decimal type info instance to associate with a decimal constant in the expression tree. To precisely determine the precision/scale of the expression result requires more accurate precision/scale of the type of the decimal constant. Thus, Hive uses a precision/scale of the constant for the type info instance. As an example, the following is not desirable:
          {code}
          hive> create table mytable as select 3.14BD as t from person_age limit 1;
          hive> desc mytable;
          OK
          t decimal(65,30) None
          Time taken: 0.08 seconds, Fetched: 1 row(s)
          {code}

          instead, the precision/scale for t above should be (3, 2).
          Xuefu Zhang made changes -
          Link This issue is required by HIVE-5356 [ HIVE-5356 ]
          Xuefu Zhang made changes -
          Attachment HIVE-5726.patch [ 12611675 ]
          Xuefu Zhang made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Xuefu Zhang made changes -
          Attachment HIVE-5726.1.patch [ 12611782 ]
          Xuefu Zhang made changes -
          Remote Link This issue links to "https://reviews.apache.org/r/15217/ (Web Link)" [ 13309 ]
          Brock Noland made changes -
          Status Patch Available [ 10002 ] Open [ 1 ]
          Xuefu Zhang made changes -
          Attachment HIVE-5726.2.patch [ 12612312 ]
          Xuefu Zhang made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Xuefu Zhang made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Fix Version/s 0.13.0 [ 12324986 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              Xuefu Zhang
              Reporter:
              Xuefu Zhang
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development