Hive
  1. Hive
  2. HIVE-6645

to_date()/to_unix_timestamp() fail with NPE if input is null

    Details

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

      Description

      hive> describe tab2;
      Query ID = jdere_20140312185454_e3ed213e-8b3a-4963-b815-19965edad587
      OK
      c1                  	timestamp           	None                
      Time taken: 0.155 seconds, Fetched: 1 row(s)
      hive> select * from tab2;
      Query ID = jdere_20140312185454_8a009070-df79-45de-8642-e85668a378d7
      OK
      NULL
      NULL
      NULL
      NULL
      NULL
      Time taken: 0.067 seconds, Fetched: 5 row(s)
      
      hive> select to_unix_timestamp(c1) from tab2;           
      hive> select to_date(c1) from tab2;          
      

      Fails with errors like:

      java.lang.Exception: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"c1":null}
              at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:401)
      Caused by: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"c1":null}
              at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.map(ExecMapper.java:195)
              at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)
              at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:429)
              at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
              at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:233)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
              at java.util.concurrent.FutureTask.run(FutureTask.java:138)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
              at java.lang.Thread.run(Thread.java:680)
      Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"c1":null}
              at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:534)
              at org.apache.hadoop.hive.ql.exec.mr.ExecMapper.map(ExecMapper.java:177)
              ... 10 more
      Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Error evaluating to_date(c1)
              at org.apache.hadoop.hive.ql.exec.SelectOperator.processOp(SelectOperator.java:84)
              at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:790)
              at org.apache.hadoop.hive.ql.exec.TableScanOperator.processOp(TableScanOperator.java:92)
              at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:790)
              at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:524)
              ... 11 more
      Caused by: java.lang.NullPointerException
              at org.apache.hadoop.hive.ql.udf.generic.GenericUDFDate.evaluate(GenericUDFDate.java:106)
              at org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator._evaluate(ExprNodeGenericFuncEvaluator.java:166)
              at org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator.evaluate(ExprNodeEvaluator.java:77)
              at org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator.evaluate(ExprNodeEvaluator.java:65)
              at org.apache.hadoop.hive.ql.exec.SelectOperator.processOp(SelectOperator.java:79)
              ... 15 more
      
      1. HIVE-6645.2.patch
        15 kB
        Jason Dere
      2. HIVE-6645.2.patch
        15 kB
        Jason Dere
      3. HIVE-6645.1.patch
        15 kB
        Jason Dere

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Jason Dere
              Reporter:
              Jason Dere
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development