You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Hive QA (JIRA)" <ji...@apache.org> on 2017/09/09 00:38:00 UTC

[jira] [Commented] (HIVE-17030) HPL/SQL: Many cast operations are ignored without warning or notice.

    [ https://issues.apache.org/jira/browse/HIVE-17030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16159590#comment-16159590 ] 

Hive QA commented on HIVE-17030:
--------------------------------



Here are the results of testing the latest attachment:
https://issues.apache.org/jira/secure/attachment/12886087/HIVE-17030.1.patch

{color:green}SUCCESS:{color} +1 due to 1 test(s) being added or modified.

{color:red}ERROR:{color} -1 due to 4 failed/errored test(s), 11035 tests executed
*Failed tests:*
{noformat}
TestAccumuloCliDriver - did not produce a TEST-*.xml file (likely timed out) (batchId=230)
TestDummy - did not produce a TEST-*.xml file (likely timed out) (batchId=230)
org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[insert_values_orig_table_use_metadata] (batchId=61)
org.apache.hadoop.hive.cli.TestPerfCliDriver.testCliDriver[query14] (batchId=234)
{noformat}

Test results: https://builds.apache.org/job/PreCommit-HIVE-Build/6737/testReport
Console output: https://builds.apache.org/job/PreCommit-HIVE-Build/6737/console
Test logs: http://104.198.109.242/logs/PreCommit-HIVE-Build-6737/

Messages:
{noformat}
Executing org.apache.hive.ptest.execution.TestCheckPhase
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: 4 tests failed
{noformat}

This message is automatically generated.

ATTACHMENT ID: 12886087 - PreCommit-HIVE-Build

> HPL/SQL: Many cast operations are ignored without warning or notice.
> --------------------------------------------------------------------
>
>                 Key: HIVE-17030
>                 URL: https://issues.apache.org/jira/browse/HIVE-17030
>             Project: Hive
>          Issue Type: Bug
>          Components: hpl/sql
>            Reporter: Carter Shanklin
>            Assignee: Dmitry Tolpeko
>            Priority: Critical
>         Attachments: HIVE-17030.1.patch
>
>
> This bug is part of a series of issues and surprising behavior I encountered writing a reporting script that would aggregate values and give rows different classifications based on an the aggregate. Addressing some or all of these issues would make HPL/SQL more accessible to newcomers.
> Consider this code:
> {code}
>   val1d := cast('10.0' as double);
>   val2d := cast('5.0' as double);
>   declare val1i int = 5;
>   declare val2i int = 5;
>   val1i = val1d;
>   diff := val1i - val2i;
> {code}
> What is the value of diff? You might think it is 5 but in fact it is 0. Why? Because when you attempt to assign val1i to val1d, this code in Var.java is executed:
> {code}
>     else if (type == Type.BIGINT) {
>       if (val.type == Type.STRING) {
>         value = Long.parseLong((String)val.value);
>       }
>     }
>     else if (type == Type.DECIMAL) {
> {code}
> Since there is no case for assigning a double to a bigint, the expression is essentially ignored and the value remains the same. This behavior leads to many surprising results.
> It would be best if HPL/SQL could re-use the cast code from Hive since there are a lot of cases to consider.
> Version = 3.0.0-SNAPSHOT r71f52d8ad512904b3f2c4f04fe39a33f2834f1f2



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)