You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Csaba Ringhofer (Jira)" <ji...@apache.org> on 2023/03/01 18:47:00 UTC

[jira] [Created] (IMPALA-11960) Incorrect expression rewrites of data and timestamp conjuncts

Csaba Ringhofer created IMPALA-11960:
----------------------------------------

             Summary: Incorrect expression rewrites of data and timestamp conjuncts
                 Key: IMPALA-11960
                 URL: https://issues.apache.org/jira/browse/IMPALA-11960
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
            Reporter: Csaba Ringhofer


To reproduce:
{code}
create table t3 (b timestamp, ti date);
insert into t3 values ("2023-01-01 09:00:00", "2023-01-01");
enable_expr_rewrites=true;
select * from t3 where ti = cast(b as date) and  b <'2023-01-01 15:00:00';
-- returned 0 row
enable_expr_rewrites=false;
select * from t3 where ti = cast(b as date) and  b <'2023-01-01 15:00:00';
-- returned 1 row
{code}

The cause seems to be that a conjunct like ti <cast(cast('2023-01-01 15:00:00' as timestamp) as date) is created during
https://github.com/apache/impala/blob/23c265d12804c91c08a08a0be92c155424ea3d99/fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java#L1860

Casting the right side to date leads to truncating the time part and rejecting values during the given day.

The issue was probably introduced by IMPALA-10064:



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

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