private static void cleanupJoins(SubplanOperator s) { for (ILogicalPlan p : s.getNestedPlans()) { for (Mutable<ILogicalOperator> r : p.getRoots()) { cleanupJoins(r); } } }
/** clean up joins that have one input branch that is empty tuple source */ private static void cleanupJoins(Mutable<ILogicalOperator> opRef) { if (opRef.getValue() instanceof AbstractBinaryJoinOperator) { for (Mutable<ILogicalOperator> inputRef : opRef.getValue().getInputs()) { if (inputRef.getValue().getOperatorTag() == LogicalOperatorTag.EMPTYTUPLESOURCE) { opRef.getValue().getInputs().remove(inputRef); opRef.setValue(opRef.getValue().getInputs().get(0).getValue()); break; } } } for (Mutable<ILogicalOperator> inputRef : opRef.getValue().getInputs()) { cleanupJoins(inputRef); } }
cleanupJoins(subplan); InnerJoinOperator join = new InnerJoinOperator(new MutableObject<ILogicalExpression>(ConstantExpression.TRUE)); join.setSourceLocation(op.getSourceLocation());