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

UDF GenericUDFReflect cannot find classes added by "ADD JAR"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.2.1
    • None
    • UDF
    • None

    Description

      When run below command:

      hive -e "add jar /root/hive/TestReflect.jar; \
      select reflect('com.yshi.hive.TestReflect', 'testReflect', code) from sample_07 limit 3"

      Get below error:

      Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: UDFReflect evaluate
      

      The full stack trace is:

      15/09/04 07:00:37 [main]: INFO compress.CodecPool: Got brand-new decompressor [.bz2]
      Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: UDFReflect evaluate
      15/09/04 07:00:37 [main]: ERROR CliDriver: Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: UDFReflect evaluate
      java.io.IOException: org.apache.hadoop.hive.ql.metadata.HiveException: UDFReflect evaluate
      	at org.apache.hadoop.hive.ql.exec.FetchTask.fetch(FetchTask.java:152)
      	at org.apache.hadoop.hive.ql.Driver.getResults(Driver.java:1657)
      	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:227)
      	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:159)
      	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:370)
      	at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:756)
      	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
      	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
      	at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
      Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: UDFReflect evaluate
      	at org.apache.hadoop.hive.ql.udf.generic.GenericUDFReflect.evaluate(GenericUDFReflect.java:107)
      	at org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator._evaluate(ExprNodeGenericFuncEvaluator.java:185)
      	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:77)
      	at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:815)
      	at org.apache.hadoop.hive.ql.exec.TableScanOperator.processOp(TableScanOperator.java:95)
      	at org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:424)
      	at org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:416)
      	at org.apache.hadoop.hive.ql.exec.FetchTask.fetch(FetchTask.java:138)
      	... 13 more
      Caused by: java.lang.ClassNotFoundException: com.yshi.hive.TestReflect
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      	at java.lang.Class.forName0(Native Method)
      	at java.lang.Class.forName(Class.java:190)
      	at org.apache.hadoop.hive.ql.udf.generic.GenericUDFReflect.evaluate(GenericUDFReflect.java:105)
      	... 22 more
      

      Attachments

        1. HIVE-11733.1.patch
          1 kB
          Yibing Shi

        Issue Links

          Activity

            People

              Yibing Yibing Shi
              Yibing Yibing Shi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: