[Bug](planner) fix unassigned conjunct assigned on wrong node (#19672)

* fix unassigned conjunct assigned on wrong node
This commit is contained in:
Pxl
2023-05-17 10:28:22 +08:00
committed by GitHub
parent 2d9cc8fe8f
commit d784c99360
3 changed files with 26 additions and 7 deletions

View File

@ -1421,10 +1421,10 @@ public class Analyzer {
}
if (e.isBoundByTupleIds(tupleIds)
&& !e.isAuxExpr()
&& !globalState.assignedConjuncts.contains(e.getId())
&& (!globalState.assignedConjuncts.contains(e.getId()) || e.isConstant())
&& ((inclOjConjuncts && !e.isConstant())
|| (!globalState.ojClauseByConjunct.containsKey(e.getId())
&& !globalState.sjClauseByConjunct.containsKey(e.getId())))) {
|| (!globalState.ojClauseByConjunct.containsKey(e.getId())
&& !globalState.sjClauseByConjunct.containsKey(e.getId())))) {
result.add(e);
}
}
@ -2451,7 +2451,14 @@ public class Analyzer {
* Wrapper around getUnassignedConjuncts(List<TupleId> tupleIds).
*/
public List<Expr> getUnassignedConjuncts(PlanNode node) {
return getUnassignedConjuncts(node.getTblRefIds());
// constant conjuncts should be push down to all leaf node.
// so we need remove constant conjuncts when expr is not a leaf node.
List<Expr> unassigned = getUnassignedConjuncts(node.getTblRefIds());
if (!node.getChildren().isEmpty()) {
unassigned = unassigned.stream()
.filter(e -> !e.isConstant()).collect(Collectors.toList());
}
return unassigned;
}
/**