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

date_add()/date_sub()/datediff() fail with NPE with null input

    Details

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

      Description

      Similar to HIVE-6645, the following functions also get NPE error if the input is null:
      date_add
      date_sub
      datediff

      Diagnostic Messages for this Task:
      Error: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"t":null,"si":null,"i":null,"b":null,"f":null,"d":null,"dc":null,"bo":null,"s":null,"s2":null,"ts":null,"ts2":null,"dt":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:430)
      	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:342)
      	at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168)
      	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:1548)
      	at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:163)
      Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"t":null,"si":null,"i":null,"b":null,"f":null,"d":null,"dc":null,"bo":null,"s":null,"s2":null,"ts":null,"ts2":null,"dt":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)
      	... 8 more
      Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Error evaluating date_add(ts, 2)
      	at org.apache.hadoop.hive.ql.exec.SelectOperator.processOp(SelectOperator.java:84)
      	at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:791)
      	at org.apache.hadoop.hive.ql.exec.TableScanOperator.processOp(TableScanOperator.java:92)
      	at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:791)
      	at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:524)
      	... 9 more
      Caused by: java.lang.NullPointerException
      	at org.apache.hadoop.hive.ql.udf.generic.GenericUDFDateAdd.evaluate(GenericUDFDateAdd.java:144)
      	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)
      	... 13 more
      
      
      FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: