I have to read existing hive udf in spark, so in spark.sql I am creating temporary function and using it, It is working fine in spark shell but in spark-submit it's failing with the error:
org.apache.hadoop.hive.metadata.HiveException : unable to execute method public static boolean com.xxx.x.x.udfs.isb_udf.evaluate(Java.lang.string) on object xxxx.udf of class xxxx with args {Java.lang.string} of size 1 ...
I also see... Caused by Java.lang.reflect.InvocationTargetException
Code sample:
spark.sql("CREATE TEMPORARY FUNCTION currency AS 'com.spark.udf.FormatCurrency'");
val x = spark.sql("select currency(col1) from hive_table") ;
x.show()
Above command works in spark shell but it is not working in spark submit.
Info: If I read hive table without udf it's working in spark submit. The problem probably occurs when using hive udf.