Hive
  1. Hive
  2. HIVE-5996

Query for sum of a long column of a table with only two rows produces wrong result

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 0.12.0
    • Fix Version/s: None
    • Component/s: UDF
    • Labels:
      None
    • Hadoop Flags:
      Incompatible change

      Description

      hive> desc test2;
      OK
      l                   	bigint              	None                
      hive> select * from test2;                                 
      OK
      6666666666666666666
      5555555555555555555
      hive> select sum(l) from test2;
      OK
      -6224521851487329395
      

      It's believed that a wrap-around error occurred. It's surprising that it happens only with two rows. Same query in MySQL returns:

      mysql> select sum(l) from test;
      +----------------------+
      | sum(l)               |
      +----------------------+
      | 12222222222222222221 |
      +----------------------+
      1 row in set (0.00 sec)
      

      Hive should accommodate large number of rows. Overflowing with only two rows is very unusable.

      1. HIVE-5996.patch
        0.8 kB
        Xuefu Zhang

        Issue Links

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development