Package plan_runner.components

Examples of plan_runner.components.Component


    final List<Component> queryPlan = qp.getPlan();
    final List<String> allCompNames = qp.getComponentNames();
    Collections.sort(allCompNames);
    final int planSize = queryPlan.size();
    for (int i = 0; i < planSize; i++) {
      final Component component = queryPlan.get(i);
      final Component child = component.getChild();
      if (child == null)
        // a last component (it might be multiple of them)
        component.makeBolts(builder, killer, allCompNames, conf, partitioningType,
            StormComponent.FINAL_COMPONENT);
      else if (child.getChild() == null
          && !(child instanceof ThetaJoinDynamicComponentAdvisedEpochs))
        // if the child is dynamic, then reshuffler is NEXT_TO_LAST
        component.makeBolts(builder, killer, allCompNames, conf, partitioningType,
            StormComponent.NEXT_TO_LAST_COMPONENT);
      else
View Full Code Here


        return false;
    return true;
  }

  public static Component getLCM(Component first, Component second) {
    Component resultComp = first;
    List<String> resultAnc = ParserUtil.getSourceNameList(resultComp);
    while (!resultAnc.contains(second.getName())) {
      resultComp = resultComp.getChild();
      resultAnc = ParserUtil.getSourceNameList(resultComp);
    }
    return resultComp;
  }
View Full Code Here

    }
    return resultComp;
  }

  public static Component getLCM(List<Component> compList) {
    Component resultLCM = getLCM(compList.get(0), compList.get(1));
    for (int i = 2; i < compList.size(); i++)
      resultLCM = getLCM(resultLCM, compList.get(i));
    return resultLCM;
  }
View Full Code Here

    if (parents == null)
      // if I don't have parents I can't be LCM (I am DataSourceComponent)
      return false;

    for (int i = 0; i < parents.length; i++) {
      final Component parent = parents[i];
      final Set<String> parentAncestors = ParserUtil.getSourceNameSet(parent);
      if (contains(parentAncestors, orCompNames))
        // my parent is LCM (or its parent)
        return false;
    }
View Full Code Here

      // this is a DataSourceComponent
      return getPreOpsOutputSize((DataSourceComponent) component, schema, tan);
    else if (parents.length == 1)
      return getPreOpsOutputSize(parents[0], schema, tan);
    else if (parents.length == 2) {
      final Component firstParent = parents[0];
      final Component secondParent = parents[1];
      final int joinColumnsLength = firstParent.getHashIndexes().size();
      return getPreOpsOutputSize(firstParent, schema, tan)
          + getPreOpsOutputSize(secondParent, schema, tan) - joinColumnsLength;
    }
    throw new RuntimeException("More than two parents for a component " + component);
View Full Code Here

    return setSchema1.equals(setSchema2);
  }

  // throw away join hash indexes from the right parent
  public static TupleSchema joinSchema(Component[] parents, Map<String, CostParams> compCost) {
    final Component leftParent = parents[0];
    final Component rightParent = parents[1];
    final TupleSchema leftSchema = compCost.get(leftParent.getName()).getSchema();
    final TupleSchema rightSchema = compCost.get(rightParent.getName()).getSchema();
    final List<ColumnNameType> leftCnts = leftSchema.getSchema();
    final List<ColumnNameType> rightCnts = rightSchema.getSchema();

    // when HashExpressions are used the schema is a simple appending
    final List<Integer> leftHashIndexes = leftParent.getHashIndexes();
    final List<Integer> rightHashIndexes = rightParent.getHashIndexes();

    // ******************** similar to MyUtilities.createOutputTuple
    final List<ColumnNameType> outputSchema = new ArrayList<ColumnNameType>();

    for (int i = 0; i < leftCnts.size(); i++)
View Full Code Here

    ColumnReference colO = new ColumnReference(_ic, 0);
    ColumnReference colL = new ColumnReference(_ic, 0);
    ComparisonPredicate O_L_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP, colO,
        colL);

    Component O_Ljoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, relationOrders, relationLineitem,
            _queryPlan).setHashIndexes(Arrays.asList(1)).setJoinPredicate(O_L_comp);

    //-------------------------------------------------------------------------------------
    // set up aggregation function on a separate StormComponent(Bolt)
View Full Code Here

    final AggregateOperator agg = new AggregateSumOperator(new ColumnReference(_doubleConv, 0),
        conf);
    // Empty parameters = Cartesian Product

    Component lastJoiner = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, relationSupplier, relationNation,
            _queryPlan).addOperator(new ProjectOperator(new int[] { 0 }))
        .addOperator(agg);
    //lastJoiner.setPrintOut(false);
View Full Code Here

    ColumnReference colC = new ColumnReference(_ic, 0);
    ColumnReference colO = new ColumnReference(_ic, 1);
    ComparisonPredicate C_O_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP, colC,
        colO);

    Component C_Ojoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, relationCustomer, relationOrders,
            _queryPlan).setHashIndexes(Arrays.asList(3))
        .addOperator(new ProjectOperator(new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }))
        .setJoinPredicate(C_O_comp);

    //-------------------------------------------------------------------------------------
    List<Integer> hashNation = Arrays.asList(0);

    ProjectOperator projectionNation = new ProjectOperator(new int[] { 0, 1 });

    DataSourceComponent relationNation = new DataSourceComponent("NATION", dataPath + "nation"
        + extension, _queryPlan).setHashIndexes(hashNation).addOperator(projectionNation);
    //-------------------------------------------------------------------------------------

    ColumnReference colC_O = new ColumnReference(_ic, 3);
    ColumnReference colN = new ColumnReference(_ic, 0);
    ComparisonPredicate C_O_N_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        colC_O, colN);

    Component C_O_Njoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, C_Ojoin, relationNation, _queryPlan)
        .addOperator(new ProjectOperator(new int[] { 0, 1, 2, 4, 5, 6, 7, 9 }))
        .setHashIndexes(Arrays.asList(6)).setJoinPredicate(C_O_N_comp);

    //-------------------------------------------------------------------------------------

    List<Integer> hashLineitem = Arrays.asList(0);

    SelectOperator selectionLineitem = new SelectOperator(new ComparisonPredicate(
        new ColumnReference(_sc, 8), new ValueSpecification(_sc, MARK)));

    ProjectOperator projectionLineitem = new ProjectOperator(new int[] { 0, 5, 6 });

    DataSourceComponent relationLineitem = new DataSourceComponent("LINEITEM", dataPath
        + "lineitem" + extension, _queryPlan).setHashIndexes(hashLineitem)
        .addOperator(selectionLineitem).addOperator(projectionLineitem);

    //-------------------------------------------------------------------------------------
    // set up aggregation function on the StormComponent(Bolt) where join is performed

    //1 - discount
    ValueExpression<Double> substract = new Subtraction(
        new ValueSpecification(_doubleConv, 1.0), new ColumnReference(_doubleConv, 8));
    //extendedPrice*(1-discount)
    ValueExpression<Double> product = new Multiplication(new ColumnReference(_doubleConv, 7),
        substract);
    AggregateOperator agg = new AggregateSumOperator(product, conf)
    //.setGroupByColumns(Arrays.asList(0, 1, 4, 6, 2, 3, 5));
        .setGroupByColumns(Arrays.asList(0, 1, 4, 6, 2, 3, 5));

    ColumnReference colC_O_N = new ColumnReference(_ic, 6);
    ColumnReference colL = new ColumnReference(_ic, 0);
    ComparisonPredicate C_O_N_L_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        colC_O_N, colL);

    Component C_O_N_Ljoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, C_O_Njoin, relationLineitem, _queryPlan)
        .addOperator(new ProjectOperator(new int[] { 0, 1, 2, 3, 4, 5, 7, 9, 10 }))
        .addOperator(agg).setJoinPredicate(C_O_N_L_comp);

    //-------------------------------------------------------------------------------------
View Full Code Here

        colCustomer, colOrders);
   
    final AggregateCountOperator agg = new AggregateCountOperator(conf)
        .setGroupByColumns(Arrays.asList(1));
   
    Component lastJoiner = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, relationCustomer, relationOrders,
            _queryPlan).addOperator(agg).setJoinPredicate(comp).setContentSensitiveThetaJoinWrapper(_ic);

    //lastJoiner.setPrintOut(false);
View Full Code Here

TOP

Related Classes of plan_runner.components.Component

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.