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

UDF format_number() does not work on FLOAT types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.14.0
    • None
    • None

    Description

      #1 Show the table:
      hive> describe ssga3;
      OK
      source string
      test float
      dt timestamp
      Time taken: 0.243 seconds

      #2 Run format_number on double and it works:
      hive> select format_number(cast(test as double),2) from ssga3;
      Total MapReduce jobs = 1
      Launching Job 1 out of 1
      Number of reduce tasks is set to 0 since there's no reduce operator
      Starting Job = job_201403131616_0009, Tracking URL = http://cdh5-1:50030/jobdetails.jsp?jobid=job_201403131616_0009
      Kill Command = /opt/cloudera/parcels/CDH-4.6.0-1.cdh4.6.0.p0.26/lib/hadoop/bin/hadoop job -kill job_201403131616_0009
      Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0
      2014-03-13 17:14:53,992 Stage-1 map = 0%, reduce = 0%
      2014-03-13 17:14:59,032 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 1.47 sec
      2014-03-13 17:15:00,046 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 1.47 sec
      2014-03-13 17:15:01,056 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 1.47 sec
      2014-03-13 17:15:02,067 Stage-1 map = 100%, reduce = 100%, Cumulative CPU 1.47 sec
      MapReduce Total cumulative CPU time: 1 seconds 470 msec
      Ended Job = job_201403131616_0009
      MapReduce Jobs Launched:
      Job 0: Map: 1 Cumulative CPU: 1.47 sec HDFS Read: 299 HDFS Write: 10 SUCCESS
      Total MapReduce CPU Time Spent: 1 seconds 470 msec
      OK
      1.00
      2.00
      Time taken: 16.563 seconds

      #3 Run format_number on float and it does not work
      hive> select format_number(test,2) from ssga3;
      Total MapReduce jobs = 1
      Launching Job 1 out of 1
      Number of reduce tasks is set to 0 since there's no reduce operator
      Starting Job = job_201403131616_0010, Tracking URL = http://cdh5-1:50030/jobdetails.jsp?jobid=job_201403131616_0010
      Kill Command = /opt/cloudera/parcels/CDH-4.6.0-1.cdh4.6.0.p0.26/lib/hadoop/bin/hadoop job -kill job_201403131616_0010
      Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0
      2014-03-13 17:20:21,158 Stage-1 map = 0%, reduce = 0%
      2014-03-13 17:21:00,453 Stage-1 map = 100%, reduce = 100%
      Ended Job = job_201403131616_0010 with errors
      Error during job, obtaining debugging information...
      Job Tracking URL: http://cdh5-1:50030/jobdetails.jsp?jobid=job_201403131616_0010
      Examining task ID: task_201403131616_0010_m_000002 (and more) from job job_201403131616_0010
      Unable to retrieve URL for Hadoop Task logs. Does not contain a valid host:port authority: logicaljt
      Task with the most failures(4):
      Task ID:
      task_201403131616_0010_m_000000
      Diagnostic Messages for this Task:
      java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row

      {"source":null,"test":1.0,"dt":null}

      at org.apache.hadoop.hive.ql.exec.ExecMapper.map(ExecMapper.java:159)
      at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
      at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:417)
      at org.apache.hadoop.mapred.MapTask.run(MapTask.java:332)
      at org.apache.hadoop.mapred.Child$4.run(Child.java:268)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:415)
      at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1438)
      at org.apache.hadoop.mapred.Child.main(Child.java:262)
      Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row

      {"source":null,"test":1.0,"dt":null}

      at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:675)
      at org.apache.hadoop.hive.ql.exec.ExecMapper.map(ExecMapper.java:141)
      ..
      FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask
      MapReduce Jobs Launched:
      Job 0: Map: 1 HDFS Read: 0 HDFS Write: 0 FAIL
      Total MapReduce CPU Time Spent: 0 msec

      Attachments

        1. HIVE-7257.1.patch
          4 kB
          Wilbur Yang

        Activity

          People

            wilbur.yang Wilbur Yang
            wilbur.yang Wilbur Yang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: