Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive, mail # dev - Custom UDF can not handle constant string parameter


Copy link to this message
-
Re: Custom UDF can not handle constant string parameter
Edward Capriolo 2012-07-25, 21:02
It depends on how you wrote the UDF. One trick you can do trick hive
into thinking it is non-constant: select a column of 0 length and then
concat it.

SELECT concat(substring(colx),0,0), myUDF("constant string") ) from....

Now its not constant!

On Wed, Jul 25, 2012 at 4:52 PM, Ablimit Aji <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I wrote several UDF to handle a string typed column. However, when I feed a
> constant value to the UDF, it's not recognizing it.
> What went wrong ? How can I fix it ?
>
> Example SQL: SELECT MBB("Polygon ((0 1, 1 1, 0 1, 0 0))") FROM myTable
> limit 5;
>
> MBB(Text) returns Text value
>
> However the error I get is like this:
>
> FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments '"Polygon
> ((0 1, 1 1, 0 1, 0 0))"': org.apache.hadoop.hive.ql.metadata.HiveException:
> Unable to execute method public org.apache.hadoop.io.Text
> edu.emory.cci.hive.udf.UDFMBB.evaluate(org.apache.hadoop.io.Text)  on
> object edu.emory.cci.hive.udf.UDFMBB@213e2b4a of class
> edu.emory.cci.hive.udf.UDFMBB with arguments {Polygon ((0 1, 1 1, 0 1, 0
> 0)):org.apache.hadoop.io.Text} of size 1