Skip to content

Commit

Permalink
skip invisible column
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Dec 5, 2023
1 parent 34c85c9 commit be6da8f
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.doris.nereids.trees.expressions.ExprId;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.expressions.SlotReference;
import org.apache.doris.nereids.trees.plans.AbstractPlan;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.physical.PhysicalAssertNumRows;
Expand Down Expand Up @@ -103,10 +104,29 @@ public PhysicalHashJoin visitPhysicalHashJoin(PhysicalHashJoin<? extends Plan, ?
return join;
}

private boolean isVisibleColumn(Slot slot) {
if (slot instanceof SlotReference) {
SlotReference slotReference = (SlotReference) slot;
if (slotReference.getColumn().isPresent()) {
return slotReference.getColumn().get().isVisible();
}
}
return true;
}

@Override
public PhysicalFilter visitPhysicalFilter(PhysicalFilter<? extends Plan> filter, CascadesContext context) {
filter.child().accept(this, context);
context.getRuntimeFilterContext().addEffectiveSrcNode(filter);
for (Expression expression : filter.getExpressions()) {

}
boolean visibleFilter = filter.getExpressions().stream()
.flatMap(expression -> expression.getInputSlots().stream())
.allMatch(slot -> isVisibleColumn(slot));
if (visibleFilter) {
// skip filters like: __DORIS_DELETE_SIGN__ = 0
context.getRuntimeFilterContext().addEffectiveSrcNode(filter);
}
return filter;
}

Expand Down

0 comments on commit be6da8f

Please sign in to comment.