Package plan_runner.components

Examples of plan_runner.components.Component


      _component = component;
      _level = level;

      final Component[] parents = component.getParents();
      if (parents != null) {
        final Component leftParent = parents[0];
        _leftParentOutputSize = ParserUtil.getPreOpsOutputSize(leftParent, _schema, _tan);
      }
    }
View Full Code Here


    ColumnReference colR = new ColumnReference(_ic, 0);
    ColumnReference colN = new ColumnReference(_ic, 1);
    ComparisonPredicate R_N_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP, colR,
        colN);

    Component R_Njoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, relationRegion, relationNation1,
            _queryPlan).addOperator(new ProjectOperator(new int[] { 1 }))
        .setHashIndexes(Arrays.asList(0)).setJoinPredicate(R_N_comp);

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

    ProjectOperator projectionCustomer = new ProjectOperator(new int[] { 3, 0 });

    DataSourceComponent relationCustomer = new DataSourceComponent("CUSTOMER", dataPath
        + "customer" + extension, _queryPlan).setHashIndexes(hashCustomer).addOperator(
        projectionCustomer);

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

    ColumnReference colR_N = new ColumnReference(_ic, 0);
    ColumnReference colC = new ColumnReference(_ic, 0);
    ComparisonPredicate R_N_C_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        colR_N, colC);
    Component R_N_Cjoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, R_Njoin, relationCustomer, _queryPlan)
        .addOperator(new ProjectOperator(new int[] { 2 })).setHashIndexes(Arrays.asList(0))
        .setJoinPredicate(R_N_C_comp);

    //-------------------------------------------------------------------------------------
    List<Integer> hashSupplier = Arrays.asList(1);

    ProjectOperator projectionSupplier = new ProjectOperator(new int[] { 0, 3 });

    DataSourceComponent relationSupplier = new DataSourceComponent("SUPPLIER", dataPath
        + "supplier" + extension, _queryPlan).setHashIndexes(hashSupplier).addOperator(
        projectionSupplier);

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

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

    DataSourceComponent relationNation2 = new DataSourceComponent("NATION2", dataPath
        + "nation" + extension, _queryPlan).setHashIndexes(hashNation2).addOperator(
        projectionNation2);

    //-------------------------------------------------------------------------------------
    ColumnReference colS = new ColumnReference(_ic, 1);
    ColumnReference colN2 = new ColumnReference(_ic, 0);
    ComparisonPredicate S_N2_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP, colS,
        colN2);

    Component S_Njoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, relationSupplier, relationNation2,
            _queryPlan).addOperator(new ProjectOperator(new int[] { 0, 3 }))
        .setHashIndexes(Arrays.asList(0)).setJoinPredicate(S_N2_comp);

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

    SelectOperator selectionPart = new SelectOperator(new ComparisonPredicate(
        new ColumnReference(_sc, 4), new ValueSpecification(_sc, _type)));

    ProjectOperator projectionPart = new ProjectOperator(new int[] { 0 });

    DataSourceComponent relationPart = new DataSourceComponent("PART", dataPath + "part"
        + extension, _queryPlan).setHashIndexes(hashPart).addOperator(selectionPart)
        .addOperator(projectionPart);

    //-------------------------------------------------------------------------------------
    List<Integer> hashLineitem = Arrays.asList(1);

    //first field in projection
    ColumnReference orderKey = new ColumnReference(_sc, 0);
    //second field in projection
    ColumnReference partKey = new ColumnReference(_sc, 1);
    //third field in projection
    ColumnReference suppKey = new ColumnReference(_sc, 2);
    //forth field in projection
    ValueExpression<Double> substract = new Subtraction(
        new ValueSpecification(_doubleConv, 1.0), new ColumnReference(_doubleConv, 6));
    //extendedPrice*(1-discount)
    ValueExpression<Double> product = new Multiplication(new ColumnReference(_doubleConv, 5),
        substract);
    ProjectOperator projectionLineitem = new ProjectOperator(orderKey, partKey, suppKey,
        product);

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

    //-------------------------------------------------------------------------------------
    ColumnReference colP = new ColumnReference(_ic, 0);
    ColumnReference colL = new ColumnReference(_ic, 1);
    ComparisonPredicate P_L_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP, colP,
        colL);

    Component P_Ljoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, relationPart, relationLineitem, _queryPlan)
        .addOperator(new ProjectOperator(new int[] { 1, 3, 4 }))
        .setHashIndexes(Arrays.asList(0)).setJoinPredicate(P_L_comp)
    //                             .addOperator(agg)
    ;

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

    SelectOperator selectionOrders = new SelectOperator(new BetweenPredicate(
        new ColumnReference(_dateConv, 4), true, new ValueSpecification(_dateConv, _date1),
        true, new ValueSpecification(_dateConv, _date2)));

    //first field in projection
    ValueExpression OrdersOrderKey = new ColumnReference(_sc, 0);
    //second field in projection
    ValueExpression OrdersCustKey = new ColumnReference(_sc, 1);
    //third field in projection
    ValueExpression OrdersExtractYear = new IntegerYearFromDate(new ColumnReference<Date>(
        _dateConv, 4));
    ProjectOperator projectionOrders = new ProjectOperator(OrdersOrderKey, OrdersCustKey,
        OrdersExtractYear);

    DataSourceComponent relationOrders = new DataSourceComponent("ORDERS", dataPath + "orders"
        + extension, _queryPlan).setHashIndexes(hashOrders).addOperator(selectionOrders)
        .addOperator(projectionOrders);

    //-------------------------------------------------------------------------------------
    ColumnReference colP_L = new ColumnReference(_ic, 0);
    ColumnReference colO = new ColumnReference(_ic, 0);
    ComparisonPredicate P_L_O_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        colP_L, colO);

    Component P_L_Ojoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, P_Ljoin, relationOrders, _queryPlan)
        .addOperator(new ProjectOperator(new int[] { 1, 2, 4, 5 }))
        .setHashIndexes(Arrays.asList(0)).setJoinPredicate(P_L_O_comp);

    //-------------------------------------------------------------------------------------
    ColumnReference colS_N = new ColumnReference(_ic, 0);
    ColumnReference colP_L_O = new ColumnReference(_ic, 0);
    ComparisonPredicate S_N_P_L_O_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        colS_N, colP_L_O);

    Component S_N_P_L_Ojoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, S_Njoin, P_L_Ojoin, _queryPlan)
        .addOperator(new ProjectOperator(new int[] { 1, 3, 4, 5 }))
        .setHashIndexes(Arrays.asList(2)).setJoinPredicate(S_N_P_L_O_comp);

    //-------------------------------------------------------------------------------------
    AggregateOperator agg = new AggregateSumOperator(new ColumnReference(_doubleConv, 2), conf)
        .setGroupByColumns(Arrays.asList(1, 4));

    ColumnReference colR_N_C = new ColumnReference(_ic, 0);
    ColumnReference colS_N_P_L_O = new ColumnReference(_ic, 2);
    ComparisonPredicate R_N_C_S_N_P_L_O_comp = new ComparisonPredicate(
        ComparisonPredicate.EQUAL_OP, colR_N_C, colS_N_P_L_O);

    Component R_N_C_S_N_P_L_Ojoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, R_N_Cjoin, S_N_P_L_Ojoin, _queryPlan)
        .addOperator(agg).setJoinPredicate(R_N_C_S_N_P_L_O_comp);

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

View Full Code Here

    final ComparisonPredicate predL_O2 = new ComparisonPredicate(ComparisonPredicate.LESS_OP,
        mult, colRefOrdersTotalPrice);

    final AndPredicate predL_O = new AndPredicate(predL_O1, predL_O2);

    Component LINEITEMS_ORDERSjoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, relationLineitem, relationOrders,
            _queryPlan).setJoinPredicate(predL_O)
        .addOperator(new ProjectOperator(new int[] { 1, 2, 3, 4 }));

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

    final SelectOperator selectionPartSupp = new SelectOperator(new ComparisonPredicate(
        ComparisonPredicate.GREATER_OP, new ColumnReference(_intConv, 2),
        new ValueSpecification(_intConv, 9990)));

    final ColumnReference colRefSupplier = new ColumnReference(_intConv, 0);
    final ColumnReference colRefPartSupp = new ColumnReference(_intConv, 1);
    final ComparisonPredicate predS_P = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        colRefSupplier, colRefPartSupp);

    Component SUPPLIER_PARTSUPPjoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, relationSupplier, relationPartsupp,
            _queryPlan).setJoinPredicate(predS_P)
        .addOperator(new ProjectOperator(new int[] { 0, 1, 3 }))
        .addOperator(selectionPartSupp);

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

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

    // 1 - discount
    final ValueExpression<Double> substract = new Subtraction(new ValueSpecification(
        _doubleConv, 1.0), new ColumnReference(_doubleConv, 3));
    // extendedPrice*(1-discount)
    final ValueExpression<Double> product = new Multiplication(new ColumnReference(_doubleConv,
        2), substract);
    final AggregateOperator agg = new AggregateSumOperator(product, conf);

    final ColumnReference colRefL_OPartKey = new ColumnReference(_intConv, 0);
    final ColumnReference colRefS_PPartKey = new ColumnReference(_intConv, 1);
    final ColumnReference colRefL_OSupKey = new ColumnReference(_intConv, 1);
    final ColumnReference colRefS_PSupKey = new ColumnReference(_intConv, 0);
    final ComparisonPredicate predL_P1 = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        colRefL_OPartKey, colRefS_PPartKey);
    final ComparisonPredicate predL_P2 = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        colRefL_OSupKey, colRefS_PSupKey);
    final AndPredicate predL_P = new AndPredicate(predL_P1, predL_P2);

    Component lastJoiner = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, LINEITEMS_ORDERSjoin,
            SUPPLIER_PARTSUPPjoin, _queryPlan).setJoinPredicate(predL_P)
        .addOperator(new ProjectOperator(new int[] { 0, 1, 2, 3 })).addOperator(agg);
    //lastJoiner.setPrintOut(false);
    // -------------------------------------------------------------------------------------
View Full Code Here

  @Override
  public QueryPlan generate() {
    final NameCompGenFactory factory = new NameCompGenFactory(_map, _pq.getTan());
    final NameCompGen ncg = factory.create();

    Component first = ncg.generateDataSource(_compNames.get(0));
    for (int i = 1; i < _compNames.size(); i++) {
      final Component second = ncg.generateDataSource(_compNames.get(i));
      first = ncg.generateEquiJoin(first, second);
    }

    ParserUtil.parallelismToMap(_compNamePar, _map);
View Full Code Here

        String parserConfPath = CONF_PATH + "0_1G_tpch3_ncl";
        NameCompGen ncg = createCG(parserConfPath);
       
        DataSourceComponent customerSource = ncg.generateDataSource("CUSTOMER");
        DataSourceComponent ordersSource = ncg.generateDataSource("ORDERS");
        Component C_Ojoin = ncg.generateEquiJoin(customerSource, ordersSource);
        DataSourceComponent lineitemSource = ncg.generateDataSource("LINEITEM");
        ncg.generateEquiJoin(C_Ojoin, lineitemSource);
       
        String planStr = ParserUtil.toString(ncg.getQueryPlan());
        //LOG.info(planStr);
View Full Code Here

         * R-N-S-L-C-O        : never finish, timeout problem, 3783 nodes
         * rule bushy plan    : 51sec local mode, even less total parallelism used
         */
        DataSourceComponent regionSource = ncg.generateDataSource("REGION");
        DataSourceComponent nationSource = ncg.generateDataSource("NATION");
        Component R_Njoin = ncg.generateEquiJoin(regionSource, nationSource);
        DataSourceComponent supplierSource = ncg.generateDataSource("SUPPLIER");
        Component R_N_Sjoin = ncg.generateEquiJoin(R_Njoin, supplierSource);
        DataSourceComponent lineitemSource = ncg.generateDataSource("LINEITEM");
        Component R_N_S_Ljoin = ncg.generateEquiJoin(R_N_Sjoin, lineitemSource);
        DataSourceComponent ordersSource = ncg.generateDataSource("ORDERS");
        Component R_N_S_L_Ojoin = ncg.generateEquiJoin(R_N_S_Ljoin, ordersSource);
        DataSourceComponent customerSource = ncg.generateDataSource("CUSTOMER");
        ncg.generateEquiJoin(R_N_S_L_Ojoin, customerSource);
       
        String planStr = ParserUtil.toString(ncg.getQueryPlan());
        //LOG.info(planStr);
View Full Code Here

         * N2-C-O-L-S-N1   : 38sec, 68nodes
         * Rule lefty plan : 35sec
         */
        DataSourceComponent supplierSource = ncg.generateDataSource("SUPPLIER");
        DataSourceComponent n1Source = ncg.generateDataSource("N1");
        Component S_N1join = ncg.generateEquiJoin(supplierSource, n1Source);
        DataSourceComponent lineitemSource = ncg.generateDataSource("LINEITEM");
        Component S_N1_Ljoin = ncg.generateEquiJoin(S_N1join, lineitemSource);
        DataSourceComponent ordersSource = ncg.generateDataSource("ORDERS");
        Component S_N1_L_Ojoin = ncg.generateEquiJoin(S_N1_Ljoin, ordersSource);
        DataSourceComponent customerSource = ncg.generateDataSource("CUSTOMER");
        Component S_N1_L_O_Cjoin = ncg.generateEquiJoin(S_N1_L_Ojoin, customerSource);
        DataSourceComponent n2Source = ncg.generateDataSource("N2");
        ncg.generateEquiJoin(S_N1_L_O_Cjoin, n2Source);
       
        String planStr = ParserUtil.toString(ncg.getQueryPlan());
        //LOG.info(planStr);
View Full Code Here

         * P-L-S-N2-O-C-N1-R: cannot have parallelism more than one on the last level because of Regionkey
         * Manual bushy plan: 50sec
         */
        DataSourceComponent regionSource = ncg.generateDataSource("REGION");
        DataSourceComponent n1Source = ncg.generateDataSource("N1");
        Component R_N1join = ncg.generateEquiJoin(regionSource, n1Source);
        DataSourceComponent customerSource = ncg.generateDataSource("CUSTOMER");
        Component R_N1_Cjoin = ncg.generateEquiJoin(R_N1join, customerSource);
        DataSourceComponent ordersSource = ncg.generateDataSource("ORDERS");
        Component R_N1_C_Ojoin = ncg.generateEquiJoin(R_N1_Cjoin, ordersSource);
        DataSourceComponent lineitemSource = ncg.generateDataSource("LINEITEM");
        Component R_N1_C_O_Ljoin = ncg.generateEquiJoin(R_N1_C_Ojoin, lineitemSource);
        DataSourceComponent partSouce = ncg.generateDataSource("PART");
        Component R_N1_C_O_L_Pjoin = ncg.generateEquiJoin(R_N1_C_O_Ljoin, partSouce);
        DataSourceComponent supplierSource = ncg.generateDataSource("SUPPLIER");
        Component R_N1_C_O_L_P_Sjoin = ncg.generateEquiJoin(R_N1_C_O_L_Pjoin, supplierSource);
        DataSourceComponent n2Source = ncg.generateDataSource("N2");
        ncg.generateEquiJoin(R_N1_C_O_L_P_Sjoin, n2Source);
       
        String planStr = ParserUtil.toString(ncg.getQueryPlan());
        //LOG.info(planStr);
View Full Code Here

    }
  }

  private void assignParNonDataSource(List<CompLevel> clList) {
    for (final CompLevel cl : clList) {
      final Component comp = cl.getComponent();
      final String compName = comp.getName();
      final String compMapStr = compName + "_PAR";
      int level = cl.getLevel();

      if (comp.getParents().length < 2)
        // an operatorComponent should have no more parallelism than its
        // (only) parent
        level--;

      // TODO: for the last operatorComponent, parallelism should be based
View Full Code Here

         * L-S-N-PS-P-0     : 107nodes, more than 200sec
         * Manual lefty plan: 37sec (parallelism everywhere 1)
         */
        DataSourceComponent partSource = ncg.generateDataSource("PART");
        DataSourceComponent lineitemSource = ncg.generateDataSource("LINEITEM");
        Component P_Ljoin = ncg.generateEquiJoin(partSource, lineitemSource);
        DataSourceComponent partSuppSource = ncg.generateDataSource("PARTSUPP");
        Component P_L_SPjoin = ncg.generateEquiJoin(P_Ljoin, partSuppSource);
        DataSourceComponent ordersSource = ncg.generateDataSource("ORDERS");
        Component P_L_SP_Ojoin = ncg.generateEquiJoin(P_L_SPjoin, ordersSource);
        DataSourceComponent supplierSource = ncg.generateDataSource("SUPPLIER");
        Component P_L_SP_O_Sjoin = ncg.generateEquiJoin(P_L_SP_Ojoin, supplierSource);
        DataSourceComponent nationSource = ncg.generateDataSource("NATION");
        ncg.generateEquiJoin(P_L_SP_O_Sjoin, nationSource);
       
        String planStr = ParserUtil.toString(ncg.getQueryPlan());
        //LOG.info(planStr);
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.