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

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

Log workAgile BoardRank to TopRank to BottomVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 0.12.0
    • None
    • UDF
    • None
    • 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.

      Attachments

        1. HIVE-5996.patch
          0.8 kB
          Xuefu Zhang

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            xuefuz Xuefu Zhang Assign to me
            xuefuz Xuefu Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment