hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ablimit Aji <abli...@gmail.com>
Subject Re: Custom UDF can not handle constant string parameter
Date Wed, 25 Jul 2012 21:14:47 GMT
Thanks Edward.

However the following statement works without any problem, and my UDF is no
different from ascii UDF.

SELECT ascii("A") FROM markup LIMIT 5;

How can I write the correct UDF to achieve original simplicity ?



On Wed, Jul 25, 2012 at 5:02 PM, Edward Capriolo <edlinuxguru@gmail.com>wrote:

> 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 <ablimit@gmail.com> 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message