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 Plain View
Hive >> mail # dev >> Custom UDF can not handle constant string parameter


+
Ablimit Aji 2012-07-25, 20:52
+
Edward Capriolo 2012-07-25, 21:02
+
Ablimit Aji 2012-07-25, 21:14
Copy link to this message
-
Re: Custom UDF can not handle constant string parameter
Compare your code to the ascii udf and then make your code more ascii like :)

On Wed, Jul 25, 2012 at 5:14 PM, Ablimit Aji <[EMAIL PROTECTED]> wrote:
> 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 <[EMAIL PROTECTED]>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 <[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
>>
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