You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Oliver Krohne <ok...@hotmail.de> on 2012/12/23 16:34:25 UTC

custom UDF throws "No matching method for class"

Hi,
I've written a UDF to convert currency values which are stored in an external table as double together with the currency type as string.
The currency udf extends UDF and has one method to convert the value:
public DoubleWritable evaluate(DoubleWritable value, Text baseCurrency, Text targetCurrency)
In the select statement I call the function. value and currency are defined with the right types in the external table:convert_currency(value,currency,'EUR')
and it throws the following error:Wrong arguments ''EUR'': No matching method for class com.xxx.hive.udf.UDFCurrencyConverter with (double, string, string). Possible choices: _FUNC_(org.apache.hadoop.io.DoubleWritable, string, string) 
That is with Hive version 0.8.1.6
Has anybody a hint what is going wrong?
Thanks,Oliver
 		 	   		  

RE: custom UDF throws "No matching method for class"

Posted by Oliver Krohne <ok...@hotmail.de>.
Hi,
actually I tried that but this lead also to an error:
 Error in semantic analysis: No matching method for class org.apache.hadoop.hive.ql.udf.UDFToDouble with (struct<value:double>). Possible choices: _FUNC_(void)  _FUNC_(boolean)  _FUNC_(tinyint)  _FUNC_(smallint)  _FUNC_(int)  _FUNC_(bigint)  _FUNC_(float)  _FUNC_(string)  _FUNC_(timestamp)
I don't need null support. Can you explain the issue?
Thanks,Oliver

Date: Sun, 23 Dec 2012 10:44:26 -0500
Subject: Re: custom UDF throws "No matching method for class"
From: edlinuxguru@gmail.com
To: user@hive.apache.org

Unless you need specific support or null you could just change the UDF to accept the primitive types.

On Sun, Dec 23, 2012 at 10:34 AM, Oliver Krohne <ok...@hotmail.de> wrote:





Hi,
I've written a UDF to convert currency values which are stored in an external table as double together with the currency type as string.
The currency udf extends UDF and has one method to convert the value:

public DoubleWritable evaluate(DoubleWritable value, Text baseCurrency, Text targetCurrency)
In the select statement I call the function. value and currency are defined with the right types in the external table:
convert_currency(value,currency,'EUR')
and it throws the following error:Wrong arguments ''EUR'': No matching method for class com.xxx.hive.udf.UDFCurrencyConverter with (double, string, string). Possible choices: _FUNC_(org.apache.hadoop.io.DoubleWritable, string, string) 

That is with Hive version 0.8.1.6
Has anybody a hint what is going wrong?
Thanks,Oliver
 		 	   		  

 		 	   		  

Re: custom UDF throws "No matching method for class"

Posted by Edward Capriolo <ed...@gmail.com>.
Unless you need specific support or null you could just change the UDF to
accept the primitive types.

On Sun, Dec 23, 2012 at 10:34 AM, Oliver Krohne <ok...@hotmail.de> wrote:

>  Hi,
>
> I've written a UDF to convert currency values which are stored in an
> external table as double together with the currency type as string.
>
> The currency udf extends UDF and has one method to convert the value:
>
> public DoubleWritable evaluate(DoubleWritable value, Text baseCurrency,
> Text targetCurrency)
>
> In the select statement I call the function. value and currency are
> defined with the right types in the external table:
> convert_currency(value,currency,'EUR')
>
> and it throws the following error:
> Wrong arguments ''EUR'': No matching method for class
> com.xxx.hive.udf.UDFCurrencyConverter with (double, string, string).
> Possible choices: _FUNC_(org.apache.hadoop.io.DoubleWritable, string,
> string)
>
> That is with Hive version 0.8.1.6
>
> Has anybody a hint what is going wrong?
>
> Thanks,
> Oliver
>
>