[fix](colocate) fix colocate join while multi tables (#37729) (#37859)

cherry-pick #37729 to branch-2.1
This commit is contained in:
camby
2024-07-16 19:02:36 +08:00
committed by GitHub
parent 8440303b91
commit faa425bee5
2 changed files with 32 additions and 6 deletions

View File

@ -310,12 +310,9 @@ public class JoinUtils {
SlotReference leftSlot = (SlotReference) leftChild;
SlotReference rightSlot = (SlotReference) rightChild;
Integer leftIndex = null;
Integer rightIndex = null;
if (leftSlot.getTable().isPresent() && leftSlot.getTable().get().getId() == leftHashSpec.getTableId()) {
leftIndex = leftHashSpec.getExprIdToEquivalenceSet().get(leftSlot.getExprId());
rightIndex = rightHashSpec.getExprIdToEquivalenceSet().get(rightSlot.getExprId());
} else {
Integer leftIndex = leftHashSpec.getExprIdToEquivalenceSet().get(leftSlot.getExprId());
Integer rightIndex = rightHashSpec.getExprIdToEquivalenceSet().get(rightSlot.getExprId());
if (leftIndex == null) {
leftIndex = rightHashSpec.getExprIdToEquivalenceSet().get(leftSlot.getExprId());
rightIndex = leftHashSpec.getExprIdToEquivalenceSet().get(rightSlot.getExprId());
}