Package org.apache.flink.compiler.plan

Examples of org.apache.flink.compiler.plan.SingleInputPlanNode


      return; // silence the compiler
    }
   
    OptimizerPlanNodeResolver resolver = getOptimizerPlanNodeResolver(oPlan);
    SinkPlanNode sinkNode = resolver.getNode("Sink");
    SingleInputPlanNode reducer = resolver.getNode("Reduce");
   
    // verify the strategies
    Assert.assertEquals(ShipStrategyType.FORWARD, sinkNode.getInput().getShipStrategy());
    Assert.assertEquals(ShipStrategyType.PARTITION_HASH, reducer.getInput().getShipStrategy());
   
    Channel c = reducer.getInput();
    Assert.assertEquals(LocalStrategy.SORT, c.getLocalStrategy());
   
    FieldList ship = new FieldList(2);
    FieldList local = new FieldList(2, 5);
    Assert.assertEquals(ship, c.getShipStrategyKeys());
    Assert.assertEquals(local, c.getLocalStrategyKeys());
    Assert.assertTrue(c.getLocalStrategySortOrder()[0] == reducer.getSortOrders(0)[0]);
   
    // check that we indeed sort descending
    Assert.assertTrue(c.getLocalStrategySortOrder()[1] == groupOrder.getFieldSortDirections()[0]);
  }
View Full Code Here


    // check the optimized Plan
    // when reducer 1 distributes its data across the instances of map2, it needs to employ a local hash method,
    // because map2 has twice as many instances and key/value pairs with the same key need to be processed by the same
    // mapper respectively reducer
    SinkPlanNode sinkNode = oPlan.getDataSinks().iterator().next();
    SingleInputPlanNode red2Node = (SingleInputPlanNode) sinkNode.getPredecessor();
    SingleInputPlanNode map2Node = (SingleInputPlanNode) red2Node.getPredecessor();
   
    ShipStrategyType mapIn = map2Node.getInput().getShipStrategy();
    ShipStrategyType redIn = red2Node.getInput().getShipStrategy();
   
    Assert.assertEquals("Invalid ship strategy for an operator.", ShipStrategyType.PARTITION_HASH, mapIn);
    Assert.assertEquals("Invalid ship strategy for an operator.", ShipStrategyType.FORWARD, redIn);
  }
View Full Code Here

    // check the optimized Plan
    // when reducer 1 distributes its data across the instances of map2, it needs to employ a local hash method,
    // because map2 has twice as many instances and key/value pairs with the same key need to be processed by the same
    // mapper respectively reducer
    SinkPlanNode sinkNode = oPlan.getDataSinks().iterator().next();
    SingleInputPlanNode red2Node = (SingleInputPlanNode) sinkNode.getPredecessor();
    SingleInputPlanNode map2Node = (SingleInputPlanNode) red2Node.getPredecessor();
   
    ShipStrategyType mapIn = map2Node.getInput().getShipStrategy();
    ShipStrategyType reduceIn = red2Node.getInput().getShipStrategy();
   
    Assert.assertEquals("Invalid ship strategy for an operator.", ShipStrategyType.FORWARD, mapIn);
    Assert.assertEquals("Invalid ship strategy for an operator.", ShipStrategyType.PARTITION_HASH, reduceIn);
  }
View Full Code Here

    // check the optimized Plan
    // when reducer 1 distributes its data across the instances of map2, it needs to employ a local hash method,
    // because map2 has twice as many instances and key/value pairs with the same key need to be processed by the same
    // mapper respectively reducer
    SinkPlanNode sinkNode = oPlan.getDataSinks().iterator().next();
    SingleInputPlanNode red2Node = (SingleInputPlanNode) sinkNode.getPredecessor();
    SingleInputPlanNode map2Node = (SingleInputPlanNode) red2Node.getPredecessor();
   
    ShipStrategyType mapIn = map2Node.getInput().getShipStrategy();
    ShipStrategyType reduceIn = red2Node.getInput().getShipStrategy();
   
    Assert.assertTrue("Invalid ship strategy for an operator.",
        (ShipStrategyType.PARTITION_RANDOM ==  mapIn && ShipStrategyType.PARTITION_HASH == reduceIn) ||
        (ShipStrategyType.PARTITION_HASH == mapIn && ShipStrategyType.FORWARD == reduceIn));
View Full Code Here

    // check the optimized Plan
    // when reducer 1 distributes its data across the instances of map2, it needs to employ a local hash method,
    // because map2 has twice as many instances and key/value pairs with the same key need to be processed by the same
    // mapper respectively reducer
    SinkPlanNode sinkNode = oPlan.getDataSinks().iterator().next();
    SingleInputPlanNode red2Node = (SingleInputPlanNode) sinkNode.getPredecessor();
   
    Assert.assertEquals("The Reduce 2 Node has an invalid local strategy.", LocalStrategy.SORT, red2Node.getInput().getLocalStrategy());
  }
View Full Code Here

     
     
      // the all-reduce has no combiner, when the DOP of the input is one
     
      SourcePlanNode sourceNode = resolver.getNode("source");
      SingleInputPlanNode reduceNode = resolver.getNode("reducer");
      SinkPlanNode sinkNode = resolver.getNode("sink");
     
      // check wiring
      assertEquals(sourceNode, reduceNode.getInput().getSource());
      assertEquals(reduceNode, sinkNode.getInput().getSource());
     
      // check DOP
      assertEquals(1, sourceNode.getDegreeOfParallelism());
      assertEquals(1, reduceNode.getDegreeOfParallelism());
      assertEquals(1, sinkNode.getDegreeOfParallelism());
    }
    catch (Exception e) {
      System.err.println(e.getMessage());
      e.printStackTrace();
View Full Code Here

     
      OptimizerPlanNodeResolver resolver = getOptimizerPlanNodeResolver(op);
     
      // get the original nodes
      SourcePlanNode sourceNode = resolver.getNode("source");
      SingleInputPlanNode reduceNode = resolver.getNode("reducer");
      SinkPlanNode sinkNode = resolver.getNode("sink");
     
      // get the combiner
      SingleInputPlanNode combineNode = (SingleInputPlanNode) reduceNode.getInput().getSource();
     
      // check wiring
      assertEquals(sourceNode, combineNode.getInput().getSource());
      assertEquals(reduceNode, sinkNode.getInput().getSource());
     
      // check that both reduce and combiner have the same strategy
      assertEquals(DriverStrategy.ALL_REDUCE, reduceNode.getDriverStrategy());
      assertEquals(DriverStrategy.ALL_REDUCE, combineNode.getDriverStrategy());
     
      // check DOP
      assertEquals(8, sourceNode.getDegreeOfParallelism());
      assertEquals(8, combineNode.getDegreeOfParallelism());
      assertEquals(1, reduceNode.getDegreeOfParallelism());
      assertEquals(1, sinkNode.getDegreeOfParallelism());
    }
    catch (Exception e) {
      System.err.println(e.getMessage());
View Full Code Here

     
      OptimizerPlanNodeResolver resolver = getOptimizerPlanNodeResolver(op);
     
      // get the original nodes
      SourcePlanNode sourceNode = resolver.getNode("source");
      SingleInputPlanNode reduceNode = resolver.getNode("reducer");
      SinkPlanNode sinkNode = resolver.getNode("sink");
     
      // get the combiner
      SingleInputPlanNode combineNode = (SingleInputPlanNode) reduceNode.getInput().getSource();
     
      // check wiring
      assertEquals(sourceNode, combineNode.getInput().getSource());
      assertEquals(reduceNode, sinkNode.getInput().getSource());
     
      // check that both reduce and combiner have the same strategy
      assertEquals(DriverStrategy.SORTED_REDUCE, reduceNode.getDriverStrategy());
      assertEquals(DriverStrategy.SORTED_PARTIAL_REDUCE, combineNode.getDriverStrategy());
     
      // check the keys
      assertEquals(new FieldList(1), reduceNode.getKeys(0));
      assertEquals(new FieldList(1), combineNode.getKeys(0));
      assertEquals(new FieldList(1), reduceNode.getInput().getLocalStrategyKeys());
     
      // check DOP
      assertEquals(6, sourceNode.getDegreeOfParallelism());
      assertEquals(6, combineNode.getDegreeOfParallelism());
      assertEquals(8, reduceNode.getDegreeOfParallelism());
      assertEquals(8, sinkNode.getDegreeOfParallelism());
    }
    catch (Exception e) {
      System.err.println(e.getMessage());
View Full Code Here

     
      OptimizerPlanNodeResolver resolver = getOptimizerPlanNodeResolver(op);
     
      // get the original nodes
      SourcePlanNode sourceNode = resolver.getNode("source");
      SingleInputPlanNode reduceNode = resolver.getNode("reducer");
      SinkPlanNode sinkNode = resolver.getNode("sink");
     
      // get the combiner
      SingleInputPlanNode combineNode = (SingleInputPlanNode) reduceNode.getInput().getSource();
     
      // get the key extractors and projectors
      SingleInputPlanNode keyExtractor = (SingleInputPlanNode) combineNode.getInput().getSource();
      SingleInputPlanNode keyProjector = (SingleInputPlanNode) sinkNode.getInput().getSource();
     
      // check wiring
      assertEquals(sourceNode, keyExtractor.getInput().getSource());
      assertEquals(keyProjector, sinkNode.getInput().getSource());
     
      // check that both reduce and combiner have the same strategy
      assertEquals(DriverStrategy.SORTED_REDUCE, reduceNode.getDriverStrategy());
      assertEquals(DriverStrategy.SORTED_PARTIAL_REDUCE, combineNode.getDriverStrategy());
     
      // check the keys
      assertEquals(new FieldList(0), reduceNode.getKeys(0));
      assertEquals(new FieldList(0), combineNode.getKeys(0));
      assertEquals(new FieldList(0), reduceNode.getInput().getLocalStrategyKeys());
     
      // check DOP
      assertEquals(6, sourceNode.getDegreeOfParallelism());
      assertEquals(6, keyExtractor.getDegreeOfParallelism());
      assertEquals(6, combineNode.getDegreeOfParallelism());
     
      assertEquals(8, reduceNode.getDegreeOfParallelism());
      assertEquals(8, keyProjector.getDegreeOfParallelism());
      assertEquals(8, sinkNode.getDegreeOfParallelism());
    }
    catch (Exception e) {
      System.err.println(e.getMessage());
      e.printStackTrace();
View Full Code Here

     
     
      // the all-reduce has no combiner, when the DOP of the input is one
     
      SourcePlanNode sourceNode = resolver.getNode("source");
      SingleInputPlanNode reduceNode = resolver.getNode("reducer");
      SinkPlanNode sinkNode = resolver.getNode("sink");
     
      // check wiring
      assertEquals(sourceNode, reduceNode.getInput().getSource());
      assertEquals(reduceNode, sinkNode.getInput().getSource());
     
      // check that reduce has the right strategy
      assertEquals(DriverStrategy.ALL_GROUP_REDUCE, reduceNode.getDriverStrategy());
     
      // check DOP
      assertEquals(1, sourceNode.getDegreeOfParallelism());
      assertEquals(1, reduceNode.getDegreeOfParallelism());
      assertEquals(1, sinkNode.getDegreeOfParallelism());
    }
    catch (Exception e) {
      System.err.println(e.getMessage());
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.flink.compiler.plan.SingleInputPlanNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.