public int getMaximumParallelism() { MaxDopVisitor visitor = new MaxDopVisitor(); accept(visitor); return Math.max(visitor.maxDop, this.defaultParallelism); }
private static void testForName(final String expected, Plan plan) { plan.accept(new Visitor<Operator<?>>() { @Override public boolean preVisit(Operator<?> visitable) { if (visitable instanceof PlanFilterOperator<?>) { // cast is actually not required. Its just a check for the right element PlanFilterOperator<?> filterOp = (PlanFilterOperator<?>) visitable; Assert.assertEquals(expected, filterOp.getName()); } return true; } @Override public void postVisit(Operator<?> visitable) { // } }); } }
public OperatorResolver(Plan p) { this.map = new HashMap<String, List<Operator<?>>>(); this.seen = new HashSet<Operator<?>>(); p.accept(this); this.seen = null; }
/** * This function performs only the first step to the compilation process - the creation of the optimizer * representation of the plan. No estimations or enumerations of alternatives are done here. * * @param program The plan to generate the optimizer representation for. * @return The optimizer representation of the plan, as a collection of all data sinks * from the plan can be traversed. */ public static List<DataSinkNode> createPreOptimizedPlan(Plan program) { GraphCreatingVisitor graphCreator = new GraphCreatingVisitor(1, null); program.accept(graphCreator); return graphCreator.getSinks(); }
plan.accept(new Visitor<org.apache.flink.api.common.operators.Operator<?>>() {
private static List<DataSinkNode> convertPlan(Plan p) { GraphCreatingVisitor dagCreator = new GraphCreatingVisitor(17, p.getExecutionConfig().getExecutionMode()); // create the DAG p.accept(dagCreator); List<DataSinkNode> sinks = dagCreator.getSinks(); // build a single root and run the branch tracking logic OptimizerNode rootNode; if (sinks.size() == 1) { rootNode = sinks.get(0); } else { Iterator<DataSinkNode> iter = sinks.iterator(); rootNode = iter.next(); while (iter.hasNext()) { rootNode = new SinkJoiner(rootNode, iter.next()); } } rootNode.accept(new IdAndEstimatesVisitor(null)); rootNode.accept(new BranchesVisitor()); return sinks; } }
program.accept(graphCreator);
@Test public void testJoinWith() { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); List<Tuple1<String>> strLi = new ArrayList<Tuple1<String>>(); strLi.add(new Tuple1<String>("a")); strLi.add(new Tuple1<String>("b")); DataSet<Tuple1<String>> strs = env.fromCollection(strLi); DataSet<Tuple1<String>> strs1 = env.fromCollection(strLi); strs.join(strs1).where(0).equalTo(0).with(new FlatJoinFunction<Tuple1<String>, Tuple1<String>, String>() { @Override public void join(Tuple1<String> first, Tuple1<String> second, Collector<String> out) throws Exception { // } }) .output(new DiscardingOutputFormat<String>()); Plan plan = env.createProgramPlan(); plan.accept(new Visitor<Operator<?>>() { @Override public boolean preVisit(Operator<?> visitable) { if (visitable instanceof InnerJoinOperatorBase) { Assert.assertEquals("Join at testJoinWith(NamesTest.java:93)", visitable.getName()); } return true; } @Override public void postVisit(Operator<?> visitable) {} }); }
plan.accept(sourceCollector);
plan.accept(new Visitor<Operator<?>>() { @Override public boolean preVisit(Operator<?> visitable) {
public int getMaximumParallelism() { MaxDopVisitor visitor = new MaxDopVisitor(); accept(visitor); return Math.max(visitor.maxDop, this.defaultParallelism); }
public int getMaximumParallelism() { MaxDopVisitor visitor = new MaxDopVisitor(); accept(visitor); return Math.max(visitor.maxDop, this.defaultParallelism); }
/** * This function performs only the first step to the compilation process - the creation of the optimizer * representation of the plan. No estimations or enumerations of alternatives are done here. * * @param program The plan to generate the optimizer representation for. * @return The optimizer representation of the plan, as a collection of all data sinks * from the plan can be traversed. */ public static List<DataSinkNode> createPreOptimizedPlan(Plan program) { GraphCreatingVisitor graphCreator = new GraphCreatingVisitor(1, null); program.accept(graphCreator); return graphCreator.getSinks(); }
/** * This function performs only the first step to the compilation process - the creation of the optimizer * representation of the plan. No estimations or enumerations of alternatives are done here. * * @param program The plan to generate the optimizer representation for. * @return The optimizer representation of the plan, as a collection of all data sinks * from the plan can be traversed. */ public static List<DataSinkNode> createPreOptimizedPlan(Plan program) { GraphCreatingVisitor graphCreator = new GraphCreatingVisitor(1, null); program.accept(graphCreator); return graphCreator.getSinks(); }
/** * This function performs only the first step to the compilation process - the creation of the optimizer * representation of the plan. No estimations or enumerations of alternatives are done here. * * @param program The plan to generate the optimizer representation for. * @return The optimizer representation of the plan, as a collection of all data sinks * from the plan can be traversed. */ public static List<DataSinkNode> createPreOptimizedPlan(Plan program) { GraphCreatingVisitor graphCreator = new GraphCreatingVisitor(1, null); program.accept(graphCreator); return graphCreator.getSinks(); }
/** * This function performs only the first step to the compilation process - the creation of the optimizer * representation of the plan. No estimations or enumerations of alternatives are done here. * * @param program The plan to generate the optimizer representation for. * @return The optimizer representation of the plan, as a collection of all data sinks * from the plan can be traversed. */ public static List<DataSinkNode> createPreOptimizedPlan(Plan program) { GraphCreatingVisitor graphCreator = new GraphCreatingVisitor(1, null); program.accept(graphCreator); return graphCreator.getSinks(); }
plan.accept(new Visitor<org.apache.flink.api.common.operators.Operator<?>>() {
plan.accept(new Visitor<org.apache.flink.api.common.operators.Operator<?>>() {
plan.accept(new Visitor<org.apache.flink.api.common.operators.Operator<?>>() {
program.accept(graphCreator);