Skip to content

Commit

Permalink
blocking
Browse files Browse the repository at this point in the history
Signed-off-by: zombee0 <[email protected]>
  • Loading branch information
zombee0 committed Jan 2, 2025
1 parent 350d215 commit d17a6dc
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ public class DecodeCollector extends OptExpressionVisitor<DecodeInfo, DecodeInfo
private final ColumnRefSet matchChildren = new ColumnRefSet();

private final ColumnRefSet scanColumnRefSet = new ColumnRefSet();
private boolean blockingOutput = false;

public DecodeCollector(SessionVariable session) {
this.sessionVariable = session;
}

public void collect(OptExpression root, DecodeContext context) {
blockingOutput = new CheckBlockingNode().check(root);
collectImpl(root, null);
initContext(context);
}
Expand Down Expand Up @@ -607,6 +609,9 @@ public DecodeInfo visitPhysicalOlapScan(OptExpression optExpression, DecodeInfo

@Override
public DecodeInfo visitPhysicalHiveScan(OptExpression optExpression, DecodeInfo context) {
if (!blockingOutput) {
return DecodeInfo.EMPTY;
}
PhysicalHiveScanOperator scan = optExpression.getOp().cast();
HiveTable table = (HiveTable) scan.getTable();

Expand Down Expand Up @@ -934,4 +939,33 @@ public ScalarOperator visitMatchExprOperator(MatchExprOperator operator, Void co
return merge(visitChildren(operator, context), operator);
}
}

private static class CheckBlockingNode extends OptExpressionVisitor<Boolean, Void> {
private boolean visitChild(OptExpression optExpression, Void context) {
if (optExpression.getInputs().size() != 1) {
return false;
}
OptExpression child = optExpression.getInputs().get(0);
return child.getOp().accept(this, child, context);
}

@Override
public Boolean visit(OptExpression optExpression, Void context) {
return visitChild(optExpression, context);
}

@Override
public Boolean visitPhysicalTopN(OptExpression optExpression, Void context) {
return true;
}

@Override
public Boolean visitPhysicalHashAggregate(OptExpression optExpression, Void context) {
return true;
}

public boolean check(OptExpression optExpression) {
return optExpression.getOp().accept(this, optExpression, null);
}
}
}

0 comments on commit d17a6dc

Please sign in to comment.