Package org.teiid.query.optimizer.relational.plantree

Examples of org.teiid.query.optimizer.relational.plantree.PlanNode.addGroups()


    boolean first = true;
    List<SingleElementSymbol> symbols = null;
    for (PlanNode planNode : unionChildren) {
      PlanNode groupClone = NodeFactory.getNewNode(NodeConstants.Types.GROUP);
      groupClone.setProperty(Info.GROUP_COLS, LanguageObject.Util.deepClone(groupingExpressions, SingleElementSymbol.class));
      groupClone.addGroups(groupNode.getGroups());
     
      PlanNode view = RuleDecomposeJoin.createSource(group, planNode, parentMap);
     
      view.addAsParent(groupClone);
     
View Full Code Here


        first = false;
        QueryRewriter.makeSelectUnique(allSymbols, false);
        symbols = allSymbols.getSymbols();
      }
      projectPlanNode.setProperty(NodeConstants.Info.PROJECT_COLS, allSymbols.getSymbols());
        projectPlanNode.addGroups(view.getGroups());
       
        groupClone.addAsParent(projectPlanNode);
       
        if (planNode.getType() == NodeConstants.Types.ACCESS) {
          //TODO: temporarily remove the access node so that the inline view could be removed if possible
View Full Code Here

    PlanNode stageGroup = NodeFactory.getNewNode(NodeConstants.Types.GROUP);
    planNode.addAsParent(stageGroup);

    if (!stagedGroupingSymbols.isEmpty()) {
        stageGroup.setProperty(NodeConstants.Info.GROUP_COLS, new ArrayList<SingleElementSymbol>(stagedGroupingSymbols));
        stageGroup.addGroups(GroupsUsedByElementsVisitor.getGroups(stagedGroupingSymbols));
    } else {
        // if the source has no rows we need to insert a select node with criteria count(*)>0
        PlanNode selectNode = NodeFactory.getNewNode(NodeConstants.Types.SELECT);
        AggregateSymbol count = new AggregateSymbol("stagedAgg", NonReserved.COUNT, false, null); //$NON-NLS-1$
        aggregates.add(count); //consider the count aggregate for the push down call below
View Full Code Here

        PlanNode apNode = sourceNode;

        if (sourceNode.getChildCount() == 0) {
            // Create the access node and insert
            PlanNode accessNode = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
            accessNode.addGroups(sourceNode.getGroups());

            copyDependentHints(sourceNode, accessNode);

            Object hint = sourceNode.removeProperty(NodeConstants.Info.IS_OPTIONAL);
            if (hint != null) {
View Full Code Here

        critNode.setProperty(NodeConstants.Info.SELECT_CRITERIA, crit);
        if (isHaving && !AggregateSymbolCollectorVisitor.getAggregates(crit, false).isEmpty()) {
            critNode.setProperty(NodeConstants.Info.IS_HAVING, Boolean.TRUE);
        }
        // Add groups to crit node
        critNode.addGroups(GroupsUsedByElementsVisitor.getGroups(crit));
        critNode.addGroups(GroupsUsedByElementsVisitor.getGroups(critNode.getCorrelatedReferenceElements()));
        return critNode;
    }

  /**
 
View Full Code Here

        if (isHaving && !AggregateSymbolCollectorVisitor.getAggregates(crit, false).isEmpty()) {
            critNode.setProperty(NodeConstants.Info.IS_HAVING, Boolean.TRUE);
        }
        // Add groups to crit node
        critNode.addGroups(GroupsUsedByElementsVisitor.getGroups(crit));
        critNode.addGroups(GroupsUsedByElementsVisitor.getGroups(critNode.getCorrelatedReferenceElements()));
        return critNode;
    }

  /**
   * Attach a grouping node at top of tree.
View Full Code Here

    PlanNode groupNode = NodeFactory.getNewNode(NodeConstants.Types.GROUP);

    GroupBy groupBy = query.getGroupBy();
    if(groupBy != null) {
      groupNode.setProperty(NodeConstants.Info.GROUP_COLS, groupBy.getSymbols());
            groupNode.addGroups(GroupsUsedByElementsVisitor.getGroups(groupBy));
    }

    attachLast(groupNode, plan);
       
        // Mark in hints
View Full Code Here

   
    sortNode.setProperty(NodeConstants.Info.SORT_ORDER, orderBy);
    if (orderBy.hasUnrelated()) {
      sortNode.setProperty(Info.UNRELATED_SORT, true);
    }
    sortNode.addGroups(GroupsUsedByElementsVisitor.getGroups(orderBy));

    attachLast(sortNode, plan);
    return sortNode;
  }
   
View Full Code Here

  private static PlanNode attachProject(PlanNode plan, Select select) {
    PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
    projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, select.getProjectedSymbols());

    // Set groups
    projectNode.addGroups(GroupsUsedByElementsVisitor.getGroups(select));

    attachLast(projectNode, plan);
    return projectNode;
  }
View Full Code Here

            for(int i=0; i<2; i++) {
                buildTree(clauses[i], node);

                // Add groups to joinNode
                for (PlanNode child : node.getChildren()) {
                    node.addGroups(child.getGroups());
                }
            }
        } else if (clause instanceof SubqueryFromClause) {
            SubqueryFromClause sfc = (SubqueryFromClause)clause;
            GroupSymbol group = sfc.getGroupSymbol();
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.