[ https://issues.apache.org/jira/browse/HIVE6327?page=com.atlassian.jira.plugin.system.issuetabpanels:commenttabpanel&focusedCommentId=13887281#comment13887281
]
Xuefu Zhang commented on HIVE6327:

I'm not talking about method matching. I'm talking about data type in general. Double data
and decimal data are intrinsically different, and Hive shouldn't implicit convert from one
to the other. An an example, let's say there is a UDF just returns the input and it only has
"double evaluate(double input)" defined. For this, if user passes decimal input to the UDF,
hoping to get its decimal number back. In this case, I'd argue that Hive should return an
error rather than converting the input to a double and return it. I'd also contend the reverse
is also true. GenericUDF overcomes the shortcomings of UDF, where everything becomes explicit.
{quote}
I thought the point of FunctionRegistry.getMethodInternal() was to find best matching method
signature given the arguments, while doing type conversion if necessary.
{quote}
Yes, that's what hive is doing, but it doesn't mean in order to find a match, any conversion
can be performed. And the conversion is implicit. I was arguing that conversion between double
and decimal should be explicit. Thus, when finding a match, Hive shouldn't treat double and
decimal exchangeable, regardless whether hive is actually doing it or not.
I don't know what this debate is leading to, but Hive has the problem as described in the
JIRA and I'm solving it. If you have any feedback, I'd be happy to see it once you actually
see the solution.
> A few mathematic functions don't take decimal input
> 
>
> Key: HIVE6327
> URL: https://issues.apache.org/jira/browse/HIVE6327
> Project: Hive
> Issue Type: Improvement
> Affects Versions: 0.11.0, 0.12.0
> Reporter: Xuefu Zhang
> Assignee: Xuefu Zhang
>
> A few mathematical functions, such as sin() cos(), etc. don't take decimal as argument.
> {code}
> hive> show tables;
> OK
> Time taken: 0.534 seconds
> hive> create table test(d decimal(5,2));
> OK
> Time taken: 0.351 seconds
> hive> select sin(d) from test;
> FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments 'd': No matching method
for class org.apache.hadoop.hive.ql.udf.UDFSin with (decimal(5,2)). Possible choices: _FUNC_(double)
> {code}
> HIVE6246 covers only sign() function. The remaining ones, including sin, cos, tan, asin,
acos, atan, exp, ln, log, log10, log2, radians, and sqrt. These are nongeneric UDFs.

This message was sent by Atlassian JIRA
(v6.1.5#6160)
