Github user amansinha100 commented on a diff in the pull request: https://github.com/apache/drill/pull/1110#discussion_r167447232 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/InsertLocalExchangeVisitor.java --- @@ -20,133 +20,34 @@ import com.google.common.collect.Lists; import org.apache.drill.exec.planner.physical.ExchangePrel; -import org.apache.drill.exec.planner.physical.HashPrelUtil; -import org.apache.drill.exec.planner.physical.HashPrelUtil.HashExpressionCreatorHelper; -import org.apache.drill.exec.planner.physical.HashToRandomExchangePrel; import org.apache.drill.exec.planner.physical.PlannerSettings; import org.apache.drill.exec.planner.physical.Prel; -import org.apache.drill.exec.planner.physical.ProjectPrel; -import org.apache.drill.exec.planner.physical.DrillDistributionTrait.DistributionField; -import org.apache.drill.exec.planner.physical.UnorderedDeMuxExchangePrel; -import org.apache.drill.exec.planner.physical.UnorderedMuxExchangePrel; -import org.apache.drill.exec.planner.sql.DrillSqlOperator; import org.apache.drill.exec.server.options.OptionManager; import org.apache.calcite.rel.RelNode; -import org.apache.calcite.rel.type.RelDataType; -import org.apache.calcite.rel.type.RelDataTypeField; -import org.apache.calcite.rex.RexBuilder; -import org.apache.calcite.rex.RexNode; -import org.apache.calcite.rex.RexUtil; - -import java.math.BigDecimal; -import java.util.Collections; import java.util.List; public class InsertLocalExchangeVisitor extends BasePrelVisitor<Prel, Void, RuntimeException> { - private final boolean isMuxEnabled; - private final boolean isDeMuxEnabled; - - - public static class RexNodeBasedHashExpressionCreatorHelper implements HashExpressionCreatorHelper<RexNode> { - private final RexBuilder rexBuilder; - - public RexNodeBasedHashExpressionCreatorHelper(RexBuilder rexBuilder) { - this.rexBuilder = rexBuilder; - } - - @Override - public RexNode createCall(String funcName, List<RexNode> inputFields) { - final DrillSqlOperator op = - new DrillSqlOperator(funcName, inputFields.size(), true, false); - return rexBuilder.makeCall(op, inputFields); - } - } + private final OptionManager options; public static Prel insertLocalExchanges(Prel prel, OptionManager options) { boolean isMuxEnabled = options.getOption(PlannerSettings.MUX_EXCHANGE.getOptionName()).bool_val; boolean isDeMuxEnabled = options.getOption(PlannerSettings.DEMUX_EXCHANGE.getOptionName()).bool_val; if (isMuxEnabled || isDeMuxEnabled) { - return prel.accept(new InsertLocalExchangeVisitor(isMuxEnabled, isDeMuxEnabled), null); + return prel.accept(new InsertLocalExchangeVisitor(options), null); --- End diff -- Since the local variables isMuxEnabled/disabled are not being used anymore, you can remove them on lines 33, 34.
---