Unable to use an existing Hive permanent UDF from Spark SQL

前端 未结 2 1919
野性不改
野性不改 2021-02-03 23:41

I have previously registered a UDF with hive. It is permanent not TEMPORARY. It works in beeline.

CREATE FUNCTION normaliseURL AS \'com.example.hive         


        
相关标签:
2条回答
  • 2021-02-04 00:27

    It will work on spark on yarn environment however as suggested you need to use spark-shell --jars <path-to-your-hive-udf>.jar not in hdfs but in local.

    0 讨论(0)
  • 2021-02-04 00:33

    Issue is Spark 2.0 is not able to execute the functions whose JARs are located on HDFS.

    Spark SQL: Thriftserver unable to run a registered Hive UDTF

    One workaround is to define the function as a temporary function in Spark job with jar path pointing to a local edge-node path. Then call the function in same Spark job.

    CREATE TEMPORARY FUNCTION functionName as 'com.test.HiveUDF' USING JAR '/user/home/dir1/functions.jar'
    
    0 讨论(0)
提交回复
热议问题