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

Avoid null pointer exception when executing UDF

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.5.0, 0.8.0
    • 0.8.0
    • Query Processor
    • None
    • Hadoop 0.20.1, Hive0.8.0 and SUSE Linux Enterprise Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5)

    • Reviewed

    Description

      For using UDF's executed following steps

      add jar /home/udf/udf.jar;
      create temporary function grade as 'udf.Grade';
      select m.userid,m.name,grade(m.maths,m.physics,m.chemistry) from marks m;
      

      But from the above steps if we miss the first step (add jar) and execute remaining steps

      create temporary function grade as 'udf.Grade';
      select m.userid,m.name,grade(m.maths,m.physics,m.chemistry) from marks m;
      

      In tasktracker it is throwing this exception

      Caused by: java.lang.RuntimeException: Map operator initialization failed
      		 at org.apache.hadoop.hive.ql.exec.ExecMapper.configure(ExecMapper.java:121)
      		 ... 18 more
      Caused by: java.lang.RuntimeException: java.lang.NullPointerException
      		 at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:115)
      		 at org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge.initialize(GenericUDFBridge.java:126)
      		 at org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator.initialize(ExprNodeGenericFuncEvaluator.java:133)
      		 at org.apache.hadoop.hive.ql.exec.Operator.initEvaluators(Operator.java:878)
      		 at org.apache.hadoop.hive.ql.exec.Operator.initEvaluatorsAndReturnStruct(Operator.java:904)
      		 at org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:60)
      		 at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:357)
      		 at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:433)
      		 at org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:389)
      		 at org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:133)
      		 at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:357)
      		 at org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:444)
      		 at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:357)
      		 at org.apache.hadoop.hive.ql.exec.ExecMapper.configure(ExecMapper.java:98)
      		 ... 18 more
      Caused by: java.lang.NullPointerException
      		 at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
      		 at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:107)
      		 ... 31 more
      

      Instead of null pointer exception it should throw meaning full exception

      Attachments

        1. HIVE-2182.1.patch
          1 kB
          Chinna Rao Lalam
        2. HIVE-2182.2.patch
          3 kB
          Chinna Rao Lalam
        3. HIVE-2182.3.patch
          3 kB
          Chinna Rao Lalam
        4. HIVE-2182.4.patch
          196 kB
          Chinna Rao Lalam
        5. HIVE-2182.5.patch
          198 kB
          Chinna Rao Lalam
        6. HIVE-2182.patch
          3 kB
          Chinna Rao Lalam

        Activity

          People

            chinnalalam Chinna Rao Lalam
            chinnalalam Chinna Rao Lalam
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: