Package plan_runner.components

Examples of plan_runner.components.DataSourceComponent


      // improved
      final Expression orExpr = orEntry.getValue();
      if (HierarchyExtractor.isLCM(component, orCompNames))
        expr = appendAnd(expr, orExpr);
      else if (component instanceof DataSourceComponent) {
        final DataSourceComponent source = (DataSourceComponent) component;
        final Expression addedExpr = getMineSubset(source, orExpr);
        expr = appendAnd(expr, addedExpr);
      }
    }
    return expr;
View Full Code Here


  /*
   * adding a DataSourceComponent to the list of components
   */
  @Override
  public DataSourceComponent generateDataSource(String tableCompName) {
    final DataSourceComponent source = createAddDataSource(tableCompName);

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

View Full Code Here

        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

    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

    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

    // -------------------------------------------------------------------------------------
    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

  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

  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

    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

    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

TOP

Related Classes of plan_runner.components.DataSourceComponent

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.