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

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

Commit 3d24f45f9c530b7512c62a692aabf148d8236457 in impala's branch 
refs/heads/master from Steve Carlin
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=3d24f45f9 ]

IMPALA-13796: Calcite planner: Improper casting for char on join condition

For the following query:

SELECT COUNT(*) from orders t1 LEFT OUTER JOIN orders t2
ON cast(t1.o_comment as char(120)) = cast(t2.o_comment as char(120));

The join condition uses the Function "=(CHAR,CHAR)".  The function
defined within Impala uses a wildcard for the length of the char (-1).

Previous to the fix, the code detected that the char(120) needed casting,
would cast it to a char(1), and this produced erroneous results.

The fix is to make sure we don't cast from a char(x) to a char(-1).

Change-Id: Ib9f44e3d5a7623a20d9841541bb496c1dee32d1e
Reviewed-on: http://gerrit.cloudera.org:8080/22541
Tested-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Steve Carlin <[email protected]>


> Calcite Planner: Improper casting on char types
> -----------------------------------------------
>
>                 Key: IMPALA-13796
>                 URL: https://issues.apache.org/jira/browse/IMPALA-13796
>             Project: IMPALA
>          Issue Type: Sub-task
>            Reporter: Steve Carlin
>            Priority: Major
>
> Test found in: 
> [test_join_queries.py::TestTPCHJoinQueries::test_outer_joins|https://jenkins.impala.io/view/all/job/calcite-report-prototype/135/artifact/Impala/calcite_report/html/query_test_test_join_queries.py/TestTPCHJoinQueries_test_outer_joins/index.html]
> SELECT COUNT(*) from orders t1 LEFT OUTER JOIN orders t2
> ON cast(t1.o_comment as char(120)) = cast(t2.o_comment as char(120));
> In the join condition, the o_comment is getting cast to the generic "char(1)" 
> resulting in a nasty cross join.
>  
>  



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