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 "ASF subversion and git services (Jira)" <ji...@apache.org> on 2023/03/22 03:11:00 UTC

[jira] [Commented] (IMPALA-8054) Implicit cast fails with {const INT} BETWEEN FLOAT and INT

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

ASF subversion and git services commented on IMPALA-8054:
---------------------------------------------------------

Commit 04f7e8c0f9158fdfc1ab9cd85d04f3a72e9a4aea in impala's branch refs/heads/master from Peter Rozsa
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=04f7e8c0f ]

IMPALA-8054: Fix BetweenToCompound rewrite rule binary predicate creation

This patch fixes the BetweenToCompound rewrite rule's binary predicate
creation. When the BETWEEN expression gets separated, the first
operand's reference is assigned to both upper and lower binary
predicates, but in the case of different typed second and third
operands, the first operand must be cloned to make type casting unique
for both binary predicates.

Testing:
  - test cases added to exprs.test

Change-Id: Iaff4199f6d0875c38fa7e91033385c9290c57bf5
Reviewed-on: http://gerrit.cloudera.org:8080/19618
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


> Implicit cast fails with {const INT} BETWEEN FLOAT and INT
> ----------------------------------------------------------
>
>                 Key: IMPALA-8054
>                 URL: https://issues.apache.org/jira/browse/IMPALA-8054
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 3.2.0
>            Reporter: Greg Rahn
>            Assignee: Peter Rozsa
>            Priority: Major
>
> In the following query the literal number 10 needs to be compared to two different types: INT and FLOAT, but Impala fails to make the implicit cast for the FLOAT. 
> The predicates should be
> {noformat}
> predicates: (cast(10 as float) >= col4) AND (10 <= col3)
> {noformat}
> *Test cases:*
> {noformat}
> sql> describe tab4
> +------+--------+---------+
> | name | type   | comment |
> +------+--------+---------+
> | pk   | int    |         |
> | col0 | int    |         |
> | col1 | float  |         |
> | col2 | string |         |
> | col3 | int    |         |
> | col4 | float  |         |
> | col5 | string |         |
> +------+--------+---------+
> sql> SELECT col0 FROM tab4 WHERE 10 BETWEEN col4 AND col3;
> ERROR: IllegalStateException: child 0 type: FLOAT child 1 type: DOUBLE
> sql> SELECT * FROM tab4 WHERE NULL NOT BETWEEN col3 AND col1;
> ERROR: IllegalStateException: child 0 type: INT child 1 type: DOUBLE
> sql> SELECT * FROM tab4 WHERE NULL BETWEEN CAST ( NULL AS INTEGER ) AND col4
> ERROR: IllegalStateException: child 0 type: DOUBLE child 1 type: INT
> {noformat}



--
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