[fix](planner) bucket shuffle join is not recognized if the first table is a subquery (#16985)
consider sql select * from (select * from test_1) a inner join (select * from test_2) b on a.id = b.id inner join (select * from test_3) c on a.id = c.id Because a.id is from a subquery, to find its source table, need use function getSrcSlotRef().
This commit is contained in:
@ -965,6 +965,9 @@ public abstract class PlanNode extends TreeNode<PlanNode> implements PlanStats {
|
||||
}
|
||||
|
||||
public SlotRef findSrcSlotRef(SlotRef slotRef) {
|
||||
if (slotRef.getSrcSlotRef() != null) {
|
||||
slotRef = slotRef.getSrcSlotRef();
|
||||
}
|
||||
if (slotRef.getTable() instanceof OlapTable) {
|
||||
return slotRef;
|
||||
}
|
||||
|
||||
@ -78,4 +78,17 @@ suite("test_bucket_shuffle_join") {
|
||||
contains "4:VHASH JOIN\n | join op: INNER JOIN(BUCKET_SHUFFLE)"
|
||||
contains "2:VHASH JOIN\n | join op: INNER JOIN(BUCKET_SHUFFLE)"
|
||||
}
|
||||
|
||||
explain {
|
||||
sql("""select a.id,a.name,b.id,b.name
|
||||
from (select * from test_colo1) a
|
||||
inner join
|
||||
(select * from test_colo2) b
|
||||
on a.id = b.id and a.name = b.name and a.name = b.name
|
||||
inner join
|
||||
(select * from test_colo3) c
|
||||
on a.id = c.id and a.name = c.name and a.name = c.name""")
|
||||
contains "4:VHASH JOIN\n | join op: INNER JOIN(BUCKET_SHUFFLE)"
|
||||
contains "2:VHASH JOIN\n | join op: INNER JOIN(BUCKET_SHUFFLE)"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user