Package plan_runner.components

Examples of plan_runner.components.OperatorComponent


    // -------------------------------------------------------------------------------------
    final AggregateCountOperator agg = new AggregateCountOperator(conf)
        .setGroupByColumns(Arrays.asList(1));

    new OperatorComponent(CUSTOMER_ORDERSjoin, "COUNTAGG", _queryPlan).addOperator(agg)
        .setFullHashList(
            Arrays.asList("FURNITURE", "BUILDING", "MACHINERY", "HOUSEHOLD",
                "AUTOMOBILE"));

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


    final ValueExpression<Double> product = new Multiplication(new ColumnReference(_doubleConv,
        1), substract);

    final AggregateOperator aggOp = new AggregateAvgOperator(product, conf)
        .setGroupByColumns(Arrays.asList(0));
    new OperatorComponent(R_N_S_L_C_Ojoin, "FINAL_RESULT", _queryPlan).addOperator(aggOp);

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

    // -------------------------------------------------------------------------------------
    final AggregateSumOperator agg = new AggregateSumOperator(new ColumnReference(_ic, 1), conf)
        .setGroupByColumns(Arrays.asList(0));

    new OperatorComponent(CUSTOMER_ORDERSjoin, "COUNTAGG", _queryPlan).addOperator(agg)
        .setFullHashList(
            Arrays.asList("FURNITURE", "BUILDING", "MACHINERY", "HOUSEHOLD",
                "AUTOMOBILE"));

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

    // -------------------------------------------------------------------------------------
    // set up aggregation function on a separate StormComponent(Bolt)
    final DistinctOperator distinctOp = new DistinctOperator(conf, new int[] { 0 });
    final AggregateOperator aggOp = new AggregateCountOperator(conf).setGroupByColumns(
        Arrays.asList(1)).setDistinct(distinctOp);
    new OperatorComponent(O_Ljoin, "FINAL_RESULT", _queryPlan).addOperator(aggOp);

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

  }
View Full Code Here

    final ValueExpression<Double> product = new Multiplication(new ColumnReference(_doubleConv,
        1), substract);

    final AggregateOperator aggOp = new AggregateSumOperator(product, conf)
        .setGroupByColumns(Arrays.asList(0));
    new OperatorComponent(R_N_S_L_C_Ojoin, "FINAL_RESULT", _queryPlan).addOperator(aggOp);

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

    //-------------------------------------------------------------------------------------
    // set up aggregation function on a separate StormComponent(Bolt)
    AggregateOperator aggOp = new AggregateCountOperator(conf).setGroupByColumns(Arrays
        .asList(1));
    OperatorComponent finalComponent = new OperatorComponent(O_Ljoin, "FINAL_RESULT",
        _queryPlan).addOperator(aggOp);

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

  }
View Full Code Here

    ValueExpression<Double> product = new Multiplication(new ColumnReference(_doubleConv, 1),
        substract);

    AggregateOperator aggOp = new AggregateSumOperator(product, conf).setGroupByColumns(Arrays
        .asList(0));
    OperatorComponent finalComponent = new OperatorComponent(R_N_S_L_C_Ojoin, "FINAL_RESULT",
        _queryPlan).addOperator(aggOp);

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

    return joinComponent;
  }

  private OperatorComponent createAndAddOperatorComp(Component lastComponent) {
    final OperatorComponent opComp = new OperatorComponent(lastComponent,
        ParserUtil.generateUniqueName("OPERATOR"), _queryPlan);

    return opComp;
  }
View Full Code Here

  private OperatorComponent generateOperatorComp(Component lastComponent,
      NameSelectItemsVisitor selectVisitor) {
    final List<AggregateOperator> aggOps = selectVisitor.getAggOps();
    if (aggOps.size() != 1)
      return null;
    OperatorComponent opComp = null;

    // projectOperator is already set to firstAgg in attachLastJoin method
    // if we decide to do construct new NSIV, then projectOperator has to be
    // set as well
    final AggregateOperator firstAgg = aggOps.get(0);

    // Setting new level of components is only necessary for distinct in
    // aggregates
    if (firstAgg.getDistinct() != null) {
      opComp = createAndAddOperatorComp(lastComponent);

      createCompCost(opComp);
      if (_costEst != null)
        _costEst.setInputParams(opComp);

      // we can use the same firstAgg, because we no tupleSchema change
      // occurred after LAST_COMPONENT:FinalAgg and NEW_COMPONENT:FinalAgg
      // Namely, NEW_COMPONENT has only FinalAgg operator
      opComp.addOperator(firstAgg);

      if (_costEst != null)
        _costEst.setOutputParamsAndPar(opComp);
    }
View Full Code Here

        // but it's certainly pleasant to have the final result grouped
        // on nodes by group by columns.
        final boolean newLevel = !(_it.isHashedBy(lastComponent, groupByColumns));
        if (newLevel) {
          lastComponent.setHashIndexes(groupByColumns);
          new OperatorComponent(lastComponent, ParserUtil.generateUniqueName("OPERATOR"),
              _cg.getQueryPlan()).addOperator(firstAgg);

        } else
          lastComponent.addOperator(firstAgg);
      } else {
        // Sometimes groupByVEs contains other functions, so we have to
        // use projections instead of simple groupBy
        // always new level

        // WARNING: groupByVEs cannot be used on two places: that's why
        // we do deep copy
        final ProjectOperator groupByProj = new ProjectOperator(
            (List<ValueExpression>) DeepCopy.copy(groupByVEs));
        if (!(groupByProj.getExpressions() == null || groupByProj.getExpressions()
            .isEmpty()))
          firstAgg.setGroupByProjection(groupByProj);

        // current component
        lastComponent.setHashExpressions((List<ValueExpression>) DeepCopy.copy(groupByVEs));

        new OperatorComponent(lastComponent, ParserUtil.generateUniqueName("OPERATOR"),
            _cg.getQueryPlan()).addOperator(firstAgg);
      }
    } else
      throw new RuntimeException("For now only one aggregate function supported!");
  }
View Full Code Here

TOP

Related Classes of plan_runner.components.OperatorComponent

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.