[fix](nereids) need run ConvertInnerOrCrossJoin rule again after EliminateNotNull (#21346)

after running EliminateNotNull rule, the join conjuncts may be removed from inner join node.
So need run ConvertInnerOrCrossJoin rule to convert inner join with no join conjuncts to cross join node.
This commit is contained in:
starocean999
2023-07-04 10:52:36 +08:00
committed by GitHub
parent b1c16b96d6
commit 599ba4529c
4 changed files with 26 additions and 8 deletions

View File

@ -207,7 +207,8 @@ public class Rewriter extends AbstractBatchJobExecutor {
),
// eliminate useless not null or inferred not null
// TODO: wait InferPredicates to infer more not null.
bottomUp(new EliminateNotNull())
bottomUp(new EliminateNotNull()),
topDown(new ConvertInnerOrCrossJoin())
),
topic("Column pruning and infer predicate",
custom(RuleType.COLUMN_PRUNING, ColumnPruning::new),

View File

@ -21,7 +21,6 @@ import org.apache.doris.common.Pair;
import org.apache.doris.nereids.cost.Cost;
import org.apache.doris.nereids.properties.LogicalProperties;
import org.apache.doris.nereids.properties.PhysicalProperties;
import org.apache.doris.nereids.trees.expressions.literal.Literal;
import org.apache.doris.nereids.trees.plans.JoinType;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
@ -377,12 +376,12 @@ public class Group {
*/
public boolean isInnerJoinGroup() {
Plan plan = getLogicalExpression().getPlan();
if (plan instanceof LogicalJoin) {
// Right now, we only support inner join with some join conditions
return ((LogicalJoin) plan).getJoinType() == JoinType.INNER_JOIN
&& (((LogicalJoin) plan).getOtherJoinConjuncts().isEmpty()
|| !(((LogicalJoin) plan).getOtherJoinConjuncts()
.get(0) instanceof Literal));
if (plan instanceof LogicalJoin
&& ((LogicalJoin) plan).getJoinType() == JoinType.INNER_JOIN) {
// Right now, we only support inner join
Preconditions.checkArgument(!((LogicalJoin) plan).getExpressions().isEmpty(),
"inner join must have join conjuncts");
return true;
}
return false;
}