You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Manish <ma...@gmail.com> on 2014/02/13 18:15:31 UTC

Help with simple UDF error..

Hello:
While running the hive query :

hive> select "Actor", count (*) from metrics where 
array_contains(type_tuple, "Actor") and checkAttributes 
(attribute_tuple, "p1", "Actor") ;

I get this error :

FAILED: SemanticException [Error 10014]: Line 1:103 Wrong arguments 
'"Actor"': No matching method for class yk.HiveCheckAllAttributes with 
(array<string>, string, string). Possible choices: _FUNC_(string, 
string, string)


the metrics hive table schema looks like :

hive> describe metrics;
OK
col_name data_type comment
entity_uuid string
type_tuple array<string>
attribute_tuple array<string>


the class yk.HiveCheckAllAttributes extends UDF and has evaluate method 
defined as :

—snip--
public boolean evaluate(ArrayList<String> payload, String pType, String 
type) {
…
}

I have tried Text type and still go the same error..
—snip--
public boolean evaluate(Text payload, String pType, String type) {
…
}



How can I pass Hive Array<Strings> as an argument to a simple UDF?

/Manish

Re: Help with simple UDF error.. [fixed]

Posted by Manish <ma...@gmail.com>.
On 2/13/14, 9:20 AM, John Meagher wrote:
> Try changing ArrayList to just List as the argument to the evaluate function.
+1  worked thanks!


Re: Help with simple UDF error..

Posted by John Meagher <jo...@gmail.com>.
Try changing ArrayList to just List as the argument to the evaluate function.

On Thu, Feb 13, 2014 at 12:15 PM, Manish <ma...@gmail.com> wrote:
> Hello:
> While running the hive query :
>
> hive> select "Actor", count (*) from metrics where
> array_contains(type_tuple, "Actor") and checkAttributes (attribute_tuple,
> "p1", "Actor") ;
>
> I get this error :
>
> FAILED: SemanticException [Error 10014]: Line 1:103 Wrong arguments
> '"Actor"': No matching method for class yk.HiveCheckAllAttributes with
> (array<string>, string, string). Possible choices: _FUNC_(string, string,
> string)
>
>
> the metrics hive table schema looks like :
>
> hive> describe metrics;
> OK
> col_name data_type comment
> entity_uuid string
> type_tuple array<string>
> attribute_tuple array<string>
>
>
> the class yk.HiveCheckAllAttributes extends UDF and has evaluate method
> defined as :
>
> --snip--
> public boolean evaluate(ArrayList<String> payload, String pType, String
> type) {
> ...
> }
>
> I have tried Text type and still go the same error..
> --snip--
> public boolean evaluate(Text payload, String pType, String type) {
> ...
> }
>
>
>
> How can I pass Hive Array<Strings> as an argument to a simple UDF?
>
> /Manish