Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> handling null argument in custom udf


Copy link to this message
-
handling null argument in custom udf
Hi Hive community

I have a custom udf, say myfun, written in Java which I utilize like this

select myfun(col_a, col_b) from mytable where ....etc

col_b is a string type and sometimes it is null.

When that happens, my query crashes with
---------------
java.lang.RuntimeException:
org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error
while processing row
{"col_a":"val","col_b":null}
...
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Unable to
execute method public org.apache.hadoop.io.Text
---------------

public final class myfun extends UDF {
         public Text evaluate(final Text argA, final Text argB) {

I'm unsure how this shouldbe fixed in a proper way.Is the framework
looking for an overload of evaluate that would comply with the null
argument?

I need to say that the table is declared using my own json serde reading
from S3. I'm not processing nulls in my serde in any special way because
Hive seems to handle null in the right way when not passed to my own UDF.

Are there anyone out there with ideas or experiences on this issue?

thanks in advance
Søren

NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB