[jira] [Commented] (HIVE-6327) A few mathematic functions don't take decimal input
[ https://issues.apache.org/jira/browse/HIVE-6327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13890535#comment-13890535 ] Hive QA commented on HIVE-6327: --- {color:green}Overall{color}: +1 all checks pass Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12626802/HIVE-6327.1.patch {color:green}SUCCESS:{color} +1 5010 tests passed Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/1173/testReport Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/1173/console Messages: {noformat} Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase {noformat} This message is automatically generated. ATTACHMENT ID: 12626802 > A few mathematic functions don't take decimal input > --- > > Key: HIVE-6327 > URL: https://issues.apache.org/jira/browse/HIVE-6327 > Project: Hive > Issue Type: Improvement >Affects Versions: 0.11.0, 0.12.0 >Reporter: Xuefu Zhang >Assignee: Xuefu Zhang > Attachments: HIVE-6327.1.patch, HIVE-6327.patch > > > 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} > HIVE-6246 covers only sign() function. The remaining ones, including sin, > cos, tan, asin, acos, atan, exp, ln, log, log10, log2, radians, and sqrt. > These are non-generic UDFs. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (HIVE-6327) A few mathematic functions don't take decimal input
[ https://issues.apache.org/jira/browse/HIVE-6327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13889827#comment-13889827 ] Mohammad Kamrul Islam commented on HIVE-6327: - Left few minor comments in RB. > A few mathematic functions don't take decimal input > --- > > Key: HIVE-6327 > URL: https://issues.apache.org/jira/browse/HIVE-6327 > Project: Hive > Issue Type: Improvement >Affects Versions: 0.11.0, 0.12.0 >Reporter: Xuefu Zhang >Assignee: Xuefu Zhang > Attachments: HIVE-6327.patch > > > 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} > HIVE-6246 covers only sign() function. The remaining ones, including sin, > cos, tan, asin, acos, atan, exp, ln, log, log10, log2, radians, and sqrt. > These are non-generic UDFs. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (HIVE-6327) A few mathematic functions don't take decimal input
[ https://issues.apache.org/jira/browse/HIVE-6327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13889807#comment-13889807 ] Jason Dere commented on HIVE-6327: -- +1 > A few mathematic functions don't take decimal input > --- > > Key: HIVE-6327 > URL: https://issues.apache.org/jira/browse/HIVE-6327 > Project: Hive > Issue Type: Improvement >Affects Versions: 0.11.0, 0.12.0 >Reporter: Xuefu Zhang >Assignee: Xuefu Zhang > Attachments: HIVE-6327.patch > > > 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} > HIVE-6246 covers only sign() function. The remaining ones, including sin, > cos, tan, asin, acos, atan, exp, ln, log, log10, log2, radians, and sqrt. > These are non-generic UDFs. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (HIVE-6327) A few mathematic functions don't take decimal input
[ https://issues.apache.org/jira/browse/HIVE-6327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13889499#comment-13889499 ] Xuefu Zhang commented on HIVE-6327: --- The above failed test case is flaky, which is unrelated code changes in the patch. Patch is ready for review. > A few mathematic functions don't take decimal input > --- > > Key: HIVE-6327 > URL: https://issues.apache.org/jira/browse/HIVE-6327 > Project: Hive > Issue Type: Improvement >Affects Versions: 0.11.0, 0.12.0 >Reporter: Xuefu Zhang >Assignee: Xuefu Zhang > Attachments: HIVE-6327.patch > > > 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} > HIVE-6246 covers only sign() function. The remaining ones, including sin, > cos, tan, asin, acos, atan, exp, ln, log, log10, log2, radians, and sqrt. > These are non-generic UDFs. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (HIVE-6327) A few mathematic functions don't take decimal input
[ https://issues.apache.org/jira/browse/HIVE-6327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13888510#comment-13888510 ] Hive QA commented on HIVE-6327: --- {color:red}Overall{color}: -1 at least one tests failed Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12626373/HIVE-6327.patch {color:red}ERROR:{color} -1 due to 1 failed/errored test(s), 5006 tests executed *Failed tests:* {noformat} org.apache.hadoop.hive.cli.TestMinimrCliDriver.testCliDriver_bucket_num_reducers {noformat} Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/1146/testReport Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/1146/console Messages: {noformat} Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests exited with: TestsFailedException: 1 tests failed {noformat} This message is automatically generated. ATTACHMENT ID: 12626373 > A few mathematic functions don't take decimal input > --- > > Key: HIVE-6327 > URL: https://issues.apache.org/jira/browse/HIVE-6327 > Project: Hive > Issue Type: Improvement >Affects Versions: 0.11.0, 0.12.0 >Reporter: Xuefu Zhang >Assignee: Xuefu Zhang > Attachments: HIVE-6327.patch > > > 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} > HIVE-6246 covers only sign() function. The remaining ones, including sin, > cos, tan, asin, acos, atan, exp, ln, log, log10, log2, radians, and sqrt. > These are non-generic UDFs. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (HIVE-6327) A few mathematic functions don't take decimal input
[ https://issues.apache.org/jira/browse/HIVE-6327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13887281#comment-13887281 ] Xuefu Zhang commented on HIVE-6327: --- 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: HIVE-6327 > URL: https://issues.apache.org/jira/browse/HIVE-6327 > 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} > HIVE-6246 covers only sign() function. The remaining ones, including sin, > cos, tan, asin, acos, atan, exp, ln, log, log10, log2, radians, and sqrt. > These are non-generic UDFs. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (HIVE-6327) A few mathematic functions don't take decimal input
[ https://issues.apache.org/jira/browse/HIVE-6327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13887230#comment-13887230 ] Jason Dere commented on HIVE-6327: -- {quote} In general though, this is not true: we cannot just treat decimal as double in every case. {quote} Is this true? I thought the point of FunctionRegistry.getMethodInternal() was to find best matching method signature given the arguments, while doing type conversion if necessary. I would think that double/decimal would be a good match for one another, if there isn't a signature that matches the param exactly. > A few mathematic functions don't take decimal input > --- > > Key: HIVE-6327 > URL: https://issues.apache.org/jira/browse/HIVE-6327 > 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} > HIVE-6246 covers only sign() function. The remaining ones, including sin, > cos, tan, asin, acos, atan, exp, ln, log, log10, log2, radians, and sqrt. > These are non-generic UDFs. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (HIVE-6327) A few mathematic functions don't take decimal input
[ https://issues.apache.org/jira/browse/HIVE-6327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13887220#comment-13887220 ] Xuefu Zhang commented on HIVE-6327: --- Good thinking. I'm not sure what you have in mind, but my work is generic for those mathematical functions where decimal can be treated as double. In general though, this is not true: we cannot just treat decimal as double in every case. The other direction is not desirable either: we cannot implicitly convert double to decimal as hive type promotion hierarchy suggests. > A few mathematic functions don't take decimal input > --- > > Key: HIVE-6327 > URL: https://issues.apache.org/jira/browse/HIVE-6327 > 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} > HIVE-6246 covers only sign() function. The remaining ones, including sin, > cos, tan, asin, acos, atan, exp, ln, log, log10, log2, radians, and sqrt. > These are non-generic UDFs. -- This message was sent by Atlassian JIRA (v6.1.5#6160)
[jira] [Commented] (HIVE-6327) A few mathematic functions don't take decimal input
[ https://issues.apache.org/jira/browse/HIVE-6327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13887016#comment-13887016 ] Jason Dere commented on HIVE-6327: -- Maybe the function signature matching for non-generic UDFs should allow decimal args to be converted to double for these UDFs? Would be a more general fix as opposed to having to patch each of these UDFs. > A few mathematic functions don't take decimal input > --- > > Key: HIVE-6327 > URL: https://issues.apache.org/jira/browse/HIVE-6327 > 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} > HIVE-6246 covers only sign() function. The remaining ones, including sin, > cos, tan, asin, acos, atan, exp, ln, log, log10, log2, radians, and sqrt. > These are non-generic UDFs. -- This message was sent by Atlassian JIRA (v6.1.5#6160)