Examples of DataSourceComponent


Examples of plan_runner.components.DataSourceComponent

        final List<String> joinedWith = jte.getJoinedWith(bestTableName);
        // dependent on previously used tables, so might return null
        final String bestPairedTable = ts.removeBestPairedTableName(joinedWith);
        if (bestPairedTable != null) {
          // we found a pair
          final DataSourceComponent bestSource = cg.generateDataSource(bestTableName);
          final DataSourceComponent bestPairedSource = cg
              .generateDataSource(bestPairedTable);
          cg.generateEquiJoin(bestSource, bestPairedSource);
        } else
          // we have to keep this table for latter processing
          skippedBestTableNames.add(bestTableName);
      }
    }

    // second phase
    // join (2-way join components) with unused tables, until there is no
    // more tables
    List<Component> subPlans = cg.getSubPlans();

    /*
     * Why outer loop is unpairedTables, and inner is subPlans: 1) We first
     * take care of small tables 2) In general, there is smaller number of
     * unpaired tables than tables 3) Number of ancestors always grow, while
     * number of joinedTables is a constant Bad side is updating of
     * subPlanAncestors, but than has to be done anyway LinkedHashMap
     * guarantees in order iterator
     */
    List<String> unpairedTableNames = ts.removeAll();
    unpairedTableNames.addAll(skippedBestTableNames);
    while (!unpairedTableNames.isEmpty()) {
      final List<String> stillUnprocessed = new ArrayList<String>();
      // we will try to join all the tables, but some of them cannot be
      // joined before some other tables
      // that's why we have while outer loop
      for (final String unpaired : unpairedTableNames) {
        boolean processed = false;
        for (final Component currentComp : subPlans)
          if (_pq.getJte().joinExistsBetween(unpaired,
              ParserUtil.getSourceNameList(currentComp))) {
            final DataSourceComponent unpairedSource = cg.generateDataSource(unpaired);
            cg.generateEquiJoin(currentComp, unpairedSource);

            processed = true;
            break;
          }
View Full Code Here

Examples of plan_runner.components.DataSourceComponent

    final NameCompGen sourceCG = new NameCompGen(_schema, _map, this);

    final List<OrderedCostParams> sourceCostParams = new ArrayList<OrderedCostParams>();
    long totalCardinality = 0;
    for (final Table table : tableList) {
      final DataSourceComponent source = sourceCG.generateDataSource(ParserUtil
          .getComponentName(table));
      final String compName = source.getName();
      final long cardinality = sourceCG.getCostParameters(compName).getCardinality();
      totalCardinality += cardinality;
      sourceCostParams.add(new OrderedCostParams(compName, cardinality));
    }
View Full Code Here

Examples of plan_runner.components.DataSourceComponent

    if (tableList.size() == 1)
      return cg;

    // This generates a lefty query plan.
    for (int i = 0; i < tableList.size() - 1; i++) {
      final DataSourceComponent secondParent = cg.generateDataSource(ParserUtil
          .getComponentName(tableList.get(i + 1)));
      firstParent = cg.generateEquiJoin(firstParent, secondParent);
    }
    return cg;
  }
View Full Code Here

Examples of plan_runner.components.DataSourceComponent

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

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

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

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

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

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

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

Examples of plan_runner.components.DataSourceComponent

  public HyracksPlan(String dataPath, String extension, Map conf) {
    // -------------------------------------------------------------------------------------
    // start of query plan filling
    final ProjectOperator projectionCustomer = new ProjectOperator(new int[] { 0, 6 });
    final List<Integer> hashCustomer = Arrays.asList(0);
    final DataSourceComponent relationCustomer = new DataSourceComponent("CUSTOMER", dataPath
        + "customer" + extension, _queryPlan).addOperator(projectionCustomer)
        .setHashIndexes(hashCustomer);

    // -------------------------------------------------------------------------------------
    final ProjectOperator projectionOrders = new ProjectOperator(new int[] { 1 });
    final List<Integer> hashOrders = Arrays.asList(0);
    final DataSourceComponent relationOrders = new DataSourceComponent("ORDERS", dataPath
        + "orders" + extension, _queryPlan).addOperator(projectionOrders).setHashIndexes(
        hashOrders);

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

Examples of plan_runner.components.DataSourceComponent

  public RSTPlan(String dataPath, String extension, Map conf) {
    // -------------------------------------------------------------------------------------
    // start of query plan filling
    final List<Integer> hashR = Arrays.asList(1);

    final DataSourceComponent relationR = new DataSourceComponent("R", dataPath + "r"
        + extension, _queryPlan).setHashIndexes(hashR);

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

    final DataSourceComponent relationS = new DataSourceComponent("S", dataPath + "s"
        + extension, _queryPlan).setHashIndexes(hashS);

    // -------------------------------------------------------------------------------------
    final List<Integer> hashIndexes = Arrays.asList(2);

    final EquiJoinComponent R_Sjoin = new EquiJoinComponent(relationR, relationS, _queryPlan)
        .setHashIndexes(hashIndexes);

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

    final DataSourceComponent relationT = new DataSourceComponent("T", dataPath + "t"
        + extension, _queryPlan).setHashIndexes(hashT);

    // -------------------------------------------------------------------------------------
    final ValueExpression<Double> aggVe = new Multiplication(new ColumnReference(_dc, 0),
        new ColumnReference(_dc, 3));
View Full Code Here

Examples of plan_runner.components.DataSourceComponent

    SelectOperator selectionPart = new SelectOperator(new LikePredicate(new ColumnReference(
        _sc, 1), new ValueSpecification(_sc, COLOR)));

    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);

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

    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)
        .setHashIndexes(Arrays.asList(0, 2)).setJoinPredicate(P_L_comp)
        .addOperator(new ProjectOperator(new int[] { 0, 1, 3, 4, 5, 6 }));

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

    List<Integer> hashPartsupp = Arrays.asList(0, 1);

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

    DataSourceComponent relationPartsupp = new DataSourceComponent("PARTSUPP", dataPath
        + "partsupp" + extension, _queryPlan).setHashIndexes(hashPartsupp).addOperator(
        projectionPartsupp);

    //-------------------------------------------------------------------------------------
    ColumnReference colP_L1 = new ColumnReference(_ic, 0);
    ColumnReference colP_L2 = new ColumnReference(_ic, 2);
    ColumnReference colPS1 = new ColumnReference(_ic, 0);
    ColumnReference colPS2 = new ColumnReference(_ic, 1);
    ComparisonPredicate P_L_PS1_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        colP_L1, colPS1);

    ComparisonPredicate P_L_PS2_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        colP_L2, colPS2);
    AndPredicate P_L_PS = new AndPredicate(P_L_PS1_comp, P_L_PS2_comp);

    Component P_L_PSjoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, P_Ljoin, relationPartsupp, _queryPlan)
        .setHashIndexes(Arrays.asList(0))
        .addOperator(new ProjectOperator(new int[] { 1, 2, 3, 4, 5, 8 }))
        .setJoinPredicate(P_L_PS);

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

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

    ProjectOperator projectionOrders = new ProjectOperator(new ColumnReference(_sc, 0),
        new IntegerYearFromDate(new ColumnReference(_dateConv, 4)));

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

    //-------------------------------------------------------------------------------------
    ColumnReference colP_L_PS = new ColumnReference(_ic, 0);
    ColumnReference colO = new ColumnReference(_ic, 0);
    ComparisonPredicate P_L_PS_O_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        colP_L_PS, colO);

    Component P_L_PS_Ojoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, P_L_PSjoin, relationOrders, _queryPlan)
        .addOperator(new ProjectOperator(new int[] { 1, 2, 3, 4, 5, 7 }))
        .setJoinPredicate(P_L_PS_O_comp);

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

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

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

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

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

    ColumnReference P_L_PS_O = new ColumnReference(_ic, 0);
    ColumnReference colS = new ColumnReference(_ic, 0);
    ComparisonPredicate P_L_PS_O_S_comp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP,
        P_L_PS_O, colS);

    Component P_L_PS_O_Sjoin = ThetaJoinComponentFactory
        .createThetaJoinOperator(Theta_JoinType, P_L_PS_Ojoin, relationSupplier, _queryPlan)
        .setHashIndexes(Arrays.asList(5))
        .addOperator(new ProjectOperator(new int[] { 1, 2, 3, 4, 5, 7 }))
        .setJoinPredicate(P_L_PS_O_S_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);

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

Examples of plan_runner.components.DataSourceComponent

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

    final ProjectOperator projectionCustomer = new ProjectOperator(new int[] { 0, 1, 2, 3, 4,
        5, 7 });

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

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

    final SelectOperator selectionOrders = new SelectOperator(new BetweenPredicate(
        new ColumnReference(_dc, 4), true, new ValueSpecification(_dc, _date1), false,
        new ValueSpecification(_dc, _date2)));

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

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

    // -------------------------------------------------------------------------------------
    final EquiJoinComponent C_Ojoin = new EquiJoinComponent(relationCustomer, relationOrders,
        _queryPlan).setHashIndexes(Arrays.asList(3));
    // -------------------------------------------------------------------------------------
    final List<Integer> hashNation = Arrays.asList(0);

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

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

    final EquiJoinComponent C_O_Njoin = new EquiJoinComponent(C_Ojoin, relationNation,
        _queryPlan).addOperator(new ProjectOperator(new int[] { 0, 1, 2, 4, 5, 6, 7, 8 }))
        .setHashIndexes(Arrays.asList(6));
    // -------------------------------------------------------------------------------------

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

    final SelectOperator selectionLineitem = new SelectOperator(new ComparisonPredicate(
        new ColumnReference(_sc, 8), new ValueSpecification(_sc, "R")));

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

    final 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
View Full Code Here

Examples of plan_runner.components.DataSourceComponent

    SelectOperator selectionRegion = new SelectOperator(new ComparisonPredicate(
        new ColumnReference(_sc, 1), new ValueSpecification(_sc, _region)));

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

    DataSourceComponent relationRegion = new DataSourceComponent("REGION", dataPath + "region"
        + extension, _queryPlan).setHashIndexes(hashRegion).addOperator(selectionRegion)
        .addOperator(projectionRegion);

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

    ProjectOperator projectionNation1 = new ProjectOperator(new int[] { 0, 2 });

    DataSourceComponent relationNation1 = new DataSourceComponent("NATION1", dataPath
        + "nation" + extension, _queryPlan).setHashIndexes(hashNation1).addOperator(
        projectionNation1);

    //-------------------------------------------------------------------------------------
    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);
View Full Code Here

Examples of plan_runner.components.DataSourceComponent

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

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

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

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

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

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

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

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

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

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

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

    final ProjectOperator projectionPartsSupp = new ProjectOperator(new int[] { 0, 1, 2 });

    final DataSourceComponent relationPartsupp = new DataSourceComponent("PARTSUPP", dataPath
        + "partsupp" + extension, _queryPlan).setHashIndexes(hashPartsSupp).addOperator(
        projectionPartsSupp);

    // -------------------------------------------------------------------------------------
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.