Bikramjeet Vig created IMPALA-7960:
--------------------------------------

             Summary: wrong results when comparing timestamp casted to varchar 
of smaller length to a string literal in a binary predicate
                 Key: IMPALA-7960
                 URL: https://issues.apache.org/jira/browse/IMPALA-7960
             Project: IMPALA
          Issue Type: Bug
    Affects Versions: Impala 2.12.0
            Reporter: Bikramjeet Vig
            Assignee: Bikramjeet Vig


Expression rewriting seems to identify this as a redundant cast and removes it.

Steps to re-create:
{noformat}
select * from (select cast('2018-12-11 09:59:37' as timestamp) as ts) tbl where 
cast(ts as varchar(10)) = '2018-12-11';
{noformat}
output:
{noformat}
Fetched 0 row(s) 
{noformat}

Now disable expression re-writes.
{noformat}
set ENABLE_EXPR_REWRITES=false;
select * from (select cast('2018-12-11 09:59:37' as timestamp) as ts) tbl where 
cast(ts as varchar(10)) = '2018-12-11';
{noformat}

output:
{noformat}
+---------------------+
| ts                  |
+---------------------+
| 2018-12-11 09:59:37 |
+---------------------+
{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to