You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Steve Carlin (Code Review)" <ge...@cloudera.org> on 2025/02/27 15:12:55 UTC

[Impala-ASF-CR] IMPALA-13796: Calcite planner: Improper casting for char on join condition

Steve Carlin has uploaded this change for review. ( http://gerrit.cloudera.org:8080/22541


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

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
---
M java/calcite-planner/src/main/java/org/apache/impala/calcite/coercenodes/CoerceOperandShuttle.java
1 file changed, 7 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/41/22541/1
-- 
To view, visit http://gerrit.cloudera.org:8080/22541
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9f44e3d5a7623a20d9841541bb496c1dee32d1e
Gerrit-Change-Number: 22541
Gerrit-PatchSet: 1
Gerrit-Owner: Steve Carlin <sc...@cloudera.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Fang-Yu Rao <fa...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>

[Impala-ASF-CR] IMPALA-13796: Calcite planner: Improper casting for char on join condition

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22541 )

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


Patch Set 2: Verified+1


-- 
To view, visit http://gerrit.cloudera.org:8080/22541
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib9f44e3d5a7623a20d9841541bb496c1dee32d1e
Gerrit-Change-Number: 22541
Gerrit-PatchSet: 2
Gerrit-Owner: Steve Carlin <sc...@cloudera.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Fang-Yu Rao <fa...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Tue, 29 Apr 2025 06:50:46 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13796: Calcite planner: Improper casting for char on join condition

Posted by "Michael Smith (Code Review)" <ge...@cloudera.org>.
Michael Smith has posted comments on this change. ( http://gerrit.cloudera.org:8080/22541 )

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


Patch Set 1: Code-Review+1


-- 
To view, visit http://gerrit.cloudera.org:8080/22541
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib9f44e3d5a7623a20d9841541bb496c1dee32d1e
Gerrit-Change-Number: 22541
Gerrit-PatchSet: 1
Gerrit-Owner: Steve Carlin <sc...@cloudera.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Fang-Yu Rao <fa...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Wed, 05 Mar 2025 22:59:17 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13796: Calcite planner: Improper casting for char on join condition

Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/22541 )

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


Patch Set 1: Code-Review+2

Looks good to me


-- 
To view, visit http://gerrit.cloudera.org:8080/22541
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib9f44e3d5a7623a20d9841541bb496c1dee32d1e
Gerrit-Change-Number: 22541
Gerrit-PatchSet: 1
Gerrit-Owner: Steve Carlin <sc...@cloudera.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Fang-Yu Rao <fa...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Fri, 25 Apr 2025 21:35:36 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13796: Calcite planner: Improper casting for char on join condition

Posted by "Steve Carlin (Code Review)" <ge...@cloudera.org>.
Steve Carlin has posted comments on this change. ( http://gerrit.cloudera.org:8080/22541 )

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


Patch Set 2: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/22541
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib9f44e3d5a7623a20d9841541bb496c1dee32d1e
Gerrit-Change-Number: 22541
Gerrit-PatchSet: 2
Gerrit-Owner: Steve Carlin <sc...@cloudera.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Fang-Yu Rao <fa...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>
Gerrit-Comment-Date: Tue, 29 Apr 2025 12:38:02 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13796: Calcite planner: Improper casting for char on join condition

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22541 )

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


Patch Set 2:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/11805/ DRY_RUN=true


-- 
To view, visit http://gerrit.cloudera.org:8080/22541
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib9f44e3d5a7623a20d9841541bb496c1dee32d1e
Gerrit-Change-Number: 22541
Gerrit-PatchSet: 2
Gerrit-Owner: Steve Carlin <sc...@cloudera.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Fang-Yu Rao <fa...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Tue, 29 Apr 2025 00:37:40 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-13796: Calcite planner: Improper casting for char on join condition

Posted by "Steve Carlin (Code Review)" <ge...@cloudera.org>.
Steve Carlin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/22541 )

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

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 <im...@cloudera.com>
Reviewed-by: Steve Carlin <sc...@cloudera.com>
---
M java/calcite-planner/src/main/java/org/apache/impala/calcite/coercenodes/CoerceOperandShuttle.java
1 file changed, 7 insertions(+), 0 deletions(-)

Approvals:
  Impala Public Jenkins: Verified
  Steve Carlin: Looks good to me, approved

-- 
To view, visit http://gerrit.cloudera.org:8080/22541
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib9f44e3d5a7623a20d9841541bb496c1dee32d1e
Gerrit-Change-Number: 22541
Gerrit-PatchSet: 3
Gerrit-Owner: Steve Carlin <sc...@cloudera.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Fang-Yu Rao <fa...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Steve Carlin <sc...@cloudera.com>

[Impala-ASF-CR] IMPALA-13796: Calcite planner: Improper casting for char on join condition

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/22541 )

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


Patch Set 1:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/18421/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/22541
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib9f44e3d5a7623a20d9841541bb496c1dee32d1e
Gerrit-Change-Number: 22541
Gerrit-PatchSet: 1
Gerrit-Owner: Steve Carlin <sc...@cloudera.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Fang-Yu Rao <fa...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Comment-Date: Thu, 27 Feb 2025 15:39:28 +0000
Gerrit-HasComments: No