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

          Xuefu Zhang created issue -
          Xuefu Zhang made changes -
          Field Original Value New Value
          Description {quote}
          hive> desc test2;
          OK
          l bigint None
          hive> select * from test2;
          OK
          6666666666666666666
          5555555555555555555
          hive> select sum(l) from test2;
          OK
          -6224521851487329395
          {quote}
          It's believed that a wrap-around error occurred. It's surprising that it happens only with two rows. Same query in MySQL returns:
          {quote}
          mysql> select sum(l) from test;
          +----------------------+
          | sum(l) |
          +----------------------+
          | 12222222222222222221 |
          +----------------------+
          1 row in set (0.00 sec)
          {quote}
          Hive should accommodate large number of rows. Overflowing with only two rows is very unusable.
          {code}
          hive> desc test2;
          OK
          l bigint None
          hive> select * from test2;
          OK
          6666666666666666666
          5555555555555555555
          hive> select sum(l) from test2;
          OK
          -6224521851487329395
          {code}
          It's believed that a wrap-around error occurred. It's surprising that it happens only with two rows. Same query in MySQL returns:
          {code}
          mysql> select sum(l) from test;
          +----------------------+
          | sum(l) |
          +----------------------+
          | 12222222222222222221 |
          +----------------------+
          1 row in set (0.00 sec)
          {code}
          Hive should accommodate large number of rows. Overflowing with only two rows is very unusable.
          Xuefu Zhang made changes -
          Attachment HIVE-5996.patch [ 12618065 ]
          Xuefu Zhang made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Thejas M Nair made changes -
          Hadoop Flags Incompatible change [ 10342 ]
          Xuefu Zhang made changes -
          Status Patch Available [ 10002 ] Open [ 1 ]
          Xuefu Zhang made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Won't Fix [ 2 ]
          Eric Hanson made changes -
          Link This issue relates to HIVE-5878 [ HIVE-5878 ]
          Eric Hanson made changes -
          Link This issue relates to HIVE-5356 [ HIVE-5356 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development