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

Hive inconsistently converts timestamp in AVG and SUM UDAF's

    XMLWordPrintableJSON

    Details

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

      Description

      hive> select t, sum(t), count(*), sum(t)/count(*), avg(t) from ts group by t;
      ...
      OK
      1977-03-15 12:34:22.345678	 227306062  1  227306062	2.27306062345678E8
      

      As it can be seen, timestamp value (1977-03-15 12:34:22.345678) is converted with fractional part ignored in sum, while preserved in avg. As a further result, sum()/count() is not equivalent to avg.

        Attachments

        1. HIVE-5992.patch
          4 kB
          Xuefu Zhang

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: