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

round() function with large scale chokes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.9.0
    • None
    • Query Processor, UDF
    • None
    • CDH 4.2 running Hive 0.9

    Description

      ROUND(4.42330604244772E-305, 2000000000) chokes with following error:

      FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments '2000000000': org.apache.hadoop.hive.ql.metadata.HiveException: Unable to execute method public org.apache.hadoop.hive.serde2.io.DoubleWritable org.apache.hadoop.hive.ql.udf.UDFRound.evaluate(org.apache.hadoop.hive.serde2.io.DoubleWritable,org.apache.hadoop.io.IntWritable) on object org.apache.hadoop.hive.ql.udf.UDFRound@51809ab7 of class org.apache.hadoop.hive.ql.udf.UDFRound with arguments

      {1.001:org.apache.hadoop.hive.serde2.io.DoubleWritable, 2000000000:org.apache.hadoop.io.IntWritable}

      of size 2

      I think the problem might be in how Hive evaluates 2 arg ROUND(). The code uses
      BigDecimal.valueOf(d).setScale(i, RoundingMode.HALF_UP)
      which chokes by itself. I saw some changes in implementation of ROUND in hive trunk but this is still being used in RoundUtils.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mihirk Mihir Kulkarni
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: