mirror of
https://github.com/actiontech/dble.git
synced 2026-04-28 10:10:22 -05:00
[inner-1855] fix: in 'join on subquery', subquery is executed repeatedly
This commit is contained in:
@@ -536,23 +536,23 @@ public class MySQLPlanNodeVisitor {
|
||||
if (column != null && column instanceof ItemField && value != null && value instanceof ItemField) {
|
||||
joinNode.addJoinFilter(filter);
|
||||
} else {
|
||||
joinNode.setOtherJoinOnFilter(filter);
|
||||
Item orgOtherJoin = joinNode.getOtherJoinOnFilter();
|
||||
joinNode.setOtherJoinOnFilter(FilterUtils.and(orgOtherJoin, filter));
|
||||
}
|
||||
} else if (ifilter instanceof ItemCondAnd) {
|
||||
ItemCondAnd ilfand = (ItemCondAnd) ifilter;
|
||||
List<Item> subFilter = ilfand.arguments();
|
||||
if (subFilter != null) {
|
||||
for (Item arg : subFilter) {
|
||||
Item orgOtherJoin = joinNode.getOtherJoinOnFilter();
|
||||
addJoinOnColumns(arg, joinNode);
|
||||
joinNode.setOtherJoinOnFilter(FilterUtils.and(orgOtherJoin, joinNode.getOtherJoinOnFilter()));
|
||||
}
|
||||
} else {
|
||||
throw new MySQLOutPutException(ErrorCode.ER_OPTIMIZER, "", "and has no other columns , " + ifilter);
|
||||
}
|
||||
|
||||
} else {
|
||||
joinNode.setOtherJoinOnFilter(ifilter);
|
||||
Item orgOtherJoin = joinNode.getOtherJoinOnFilter();
|
||||
joinNode.setOtherJoinOnFilter(FilterUtils.and(orgOtherJoin, ifilter));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user