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

Daniel Becker commented on IMPALA-11462:
----------------------------------------

Steps to reproduce:

With literal second argument the query works as expected:
{code:java}
select shiftleft(cast(1 as bigint), 7);
+---------------------------------+
| shiftleft(cast(1 as bigint), 7) |
+---------------------------------+
| 128                             |
+---------------------------------+{code}
With non-literal second argument overflow occurs:
{code:java}
select shiftleft(cast(1 as bigint), z) c from (select 7 z ) x;
+------+
| c    |
+------+
| -128 |
+------+{code}
However, if we disable expression rewriting, it works with a non-literal second 
argument, too:
{code:java}
set ENABLE_EXPR_REWRITES=0;
select shiftleft(cast(1 as bigint), z) c from (select 7 z ) x;
+-----+
| c   |
+-----+
| 128 |
+-----+{code}

> shiftleft problem
> -----------------
>
>                 Key: IMPALA-11462
>                 URL: https://issues.apache.org/jira/browse/IMPALA-11462
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Clients
>    Affects Versions: Impala 3.4.1
>            Reporter: jack sun
>            Assignee: Daniel Becker
>            Priority: Minor
>         Attachments: screenshot-1.png
>
>
> if change the second param of function 'shiftleft' as a dynamic value , it 
> will change the first param as tinnyint
>  !screenshot-1.png! 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to