Package eu.stratosphere.compiler.plan

Examples of eu.stratosphere.compiler.plan.SingleInputPlanNode


  @Override
  public SingleInputPlanNode instantiate(Channel in, SingleInputNode node) {
    if (in.getShipStrategy() == ShipStrategyType.FORWARD ||
        (node.getBroadcastConnections() != null && !node.getBroadcastConnections().isEmpty()))
    {
      return new SingleInputPlanNode(node, "Reduce ("+node.getPactContract().getName()+")", in, DriverStrategy.SORTED_REDUCE, this.keyList);
    }
    else {
      // non forward case. all local properties are killed anyways, so we can safely plug in a combiner
      Channel toCombiner = new Channel(in.getSource());
      toCombiner.setShipStrategy(ShipStrategyType.FORWARD);
     
      // create an input node for combine with same DOP as input node
      ReduceNode combinerNode = ((ReduceNode) node).getCombinerUtilityNode();
      combinerNode.setDegreeOfParallelism(in.getSource().getDegreeOfParallelism());
      combinerNode.setSubtasksPerInstance(in.getSource().getSubtasksPerInstance());
     
      SingleInputPlanNode combiner = new SingleInputPlanNode(combinerNode, "Combine ("+node.getPactContract().getName()+")", toCombiner, DriverStrategy.SORTED_PARTIAL_REDUCE, this.keyList);
      combiner.setCosts(new Costs(0, 0));
      combiner.initProperties(toCombiner.getGlobalProperties(), toCombiner.getLocalProperties());
     
      Channel toReducer = new Channel(combiner);
      toReducer.setShipStrategy(in.getShipStrategy(), in.getShipStrategyKeys(), in.getShipStrategySortOrder());
      toReducer.setLocalStrategy(LocalStrategy.SORT, in.getLocalStrategyKeys(), in.getLocalStrategySortOrder());
      return new SingleInputPlanNode(node, "Reduce("+node.getPactContract().getName()+")", toReducer, DriverStrategy.SORTED_REDUCE, this.keyList);
    }
  }
View Full Code Here


    return DriverStrategy.FLAT_MAP;
  }

  @Override
  public SingleInputPlanNode instantiate(Channel in, SingleInputNode node) {
    return new SingleInputPlanNode(node, "Filter ("+node.getPactContract().getName()+")", in, DriverStrategy.FLAT_MAP);
  }
View Full Code Here

    return DriverStrategy.FLAT_MAP;
  }

  @Override
  public SingleInputPlanNode instantiate(Channel in, SingleInputNode node) {
    return new SingleInputPlanNode(node, "FlatMap ("+node.getPactContract().getName()+")", in, DriverStrategy.FLAT_MAP);
  }
View Full Code Here

    return DriverStrategy.ALL_GROUP_REDUCE;
  }

  @Override
  public SingleInputPlanNode instantiate(Channel in, SingleInputNode node) {
    return new SingleInputPlanNode(node, "GroupReduce ("+node.getPactContract().getName()+")", in, DriverStrategy.ALL_GROUP_REDUCE);
  }
View Full Code Here

    return DriverStrategy.COLLECTOR_MAP;
  }

  @Override
  public SingleInputPlanNode instantiate(Channel in, SingleInputNode node) {
    return new SingleInputPlanNode(node, "Map ("+node.getPactContract().getName()+")", in, DriverStrategy.COLLECTOR_MAP);
  }
View Full Code Here

    return DriverStrategy.UNARY_NO_OP;
  }

  @Override
  public SingleInputPlanNode instantiate(Channel in, SingleInputNode node) {
    return new SingleInputPlanNode(node, "Pipe", in, DriverStrategy.UNARY_NO_OP);
  }
View Full Code Here

        if (!in.getLocalStrategyKeys().isValidUnorderedPrefix(this.keys)) {
          throw new RuntimeException("Bug: Inconsistent sort for group strategy.");
        }
        in.setLocalStrategy(LocalStrategy.COMBININGSORT, in.getLocalStrategyKeys(), in.getLocalStrategySortOrder());
      }
      return new SingleInputPlanNode(node, "Reduce("+node.getPactContract().getName()+")", in, DriverStrategy.SORTED_GROUP_REDUCE, this.keyList);
    } else {
      // non forward case. all local properties are killed anyways, so we can safely plug in a combiner
      Channel toCombiner = new Channel(in.getSource());
      toCombiner.setShipStrategy(ShipStrategyType.FORWARD);
      // create an input node for combine with same DOP as input node
      GroupReduceNode combinerNode = ((GroupReduceNode) node).getCombinerUtilityNode();
      combinerNode.setDegreeOfParallelism(in.getSource().getDegreeOfParallelism());
      combinerNode.setSubtasksPerInstance(in.getSource().getSubtasksPerInstance());
     
      SingleInputPlanNode combiner = new SingleInputPlanNode(combinerNode, "Combine ("+node.getPactContract().getName()+")", toCombiner, DriverStrategy.SORTED_GROUP_COMBINE, this.keyList);
      combiner.setCosts(new Costs(0, 0));
      combiner.initProperties(toCombiner.getGlobalProperties(), toCombiner.getLocalProperties());
     
      Channel toReducer = new Channel(combiner);
      toReducer.setShipStrategy(in.getShipStrategy(), in.getShipStrategyKeys(), in.getShipStrategySortOrder());
      toReducer.setLocalStrategy(LocalStrategy.COMBININGSORT, in.getLocalStrategyKeys(), in.getLocalStrategySortOrder());
      return new SingleInputPlanNode(node, "Reduce ("+node.getPactContract().getName()+")", toReducer, DriverStrategy.SORTED_GROUP_REDUCE, this.keyList);
    }
  }
View Full Code Here

    return DriverStrategy.UNARY_NO_OP;
  }

  @Override
  public SingleInputPlanNode instantiate(Channel in, SingleInputNode node) {
    return new SingleInputPlanNode(node, "SolutionSet Delta", in, DriverStrategy.UNARY_NO_OP);
  }
View Full Code Here

        for (Iterator<PlanNode> iter = list.iterator(); iter.hasNext();) {
          PlanNode in = iter.next();
          if (in.getOriginalOptimizerNode().getPactContract() == c) {
            // is this the child or is our node the child
            if (in instanceof SingleInputPlanNode && n instanceof SingleInputPlanNode) {
              SingleInputPlanNode thisNode = (SingleInputPlanNode) n;
              SingleInputPlanNode otherNode = (SingleInputPlanNode) in;
             
              if (thisNode.getPredecessor() == otherNode) {
                // other node is child, remove it
                iter.remove();
              } else if (otherNode.getPredecessor() == thisNode) {
                shouldAdd = false;
              }
            } else {
              throw new RuntimeException("Unrecodnized case in test.");
            }
View Full Code Here

      }
     
      // get the optimizer plan nodes
      OptimizerPlanNodeResolver resolver = getOptimizerPlanNodeResolver(plan);
      SinkPlanNode sink = resolver.getNode("Word Counts");
      SingleInputPlanNode reducer = resolver.getNode("Count Words");
      SingleInputPlanNode mapper = resolver.getNode("Tokenize Lines");
     
      // verify the strategies
      Assert.assertEquals(ShipStrategyType.FORWARD, mapper.getInput().getShipStrategy());
      Assert.assertEquals(ShipStrategyType.PARTITION_HASH, reducer.getInput().getShipStrategy());
      Assert.assertEquals(ShipStrategyType.FORWARD, sink.getInput().getShipStrategy());
     
      Channel c = reducer.getInput();
      Assert.assertEquals(LocalStrategy.COMBININGSORT, c.getLocalStrategy());
      FieldList l = new FieldList(0);
      Assert.assertEquals(l, c.getShipStrategyKeys());
      Assert.assertEquals(l, c.getLocalStrategyKeys());
      Assert.assertTrue(Arrays.equals(c.getLocalStrategySortOrder(), reducer.getSortOrders()));
     
      // check the combiner
      SingleInputPlanNode combiner = (SingleInputPlanNode) reducer.getPredecessor();
      Assert.assertEquals(DriverStrategy.SORTED_GROUP_COMBINE, combiner.getDriverStrategy());
      Assert.assertEquals(l, combiner.getKeys());
      Assert.assertEquals(ShipStrategyType.FORWARD, combiner.getInput().getShipStrategy());
     
    } catch (Exception e) {
      e.printStackTrace();
      Assert.fail(e.getMessage());
    }
View Full Code Here

TOP

Related Classes of eu.stratosphere.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.