[inner-1855] fix: in 'join on subquery', subquery is executed repeatedly

This commit is contained in:
wd2365151147
2022-08-15 16:49:37 +08:00
parent 3a28544d0d
commit a60a912ccd
@@ -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));
}
}