private static PlanNode attachProject(PlanNode plan, List<? extends Expression> select) { PlanNode projectNode = createProjectNode(select); attachLast(projectNode, plan); return projectNode; }
/** * Attach DUP_REMOVE node at top of tree. The DUP_REMOVE may be pushed down * to a source (or sources) if possible by the optimizer. * @param plan Existing plan * @return Updated plan */ private static PlanNode attachDupRemoval(PlanNode plan) { PlanNode dupNode = NodeFactory.getNewNode(NodeConstants.Types.DUP_REMOVE); attachLast(dupNode, plan); return dupNode; }
/** * Attach SORT node at top of tree. The SORT may be pushed down to a source (or sources) * if possible by the optimizer. * @param plan Existing plan * @param orderBy Sort description from the query * @return Updated plan */ private static PlanNode attachSorting(PlanNode plan, OrderBy orderBy) { PlanNode sortNode = createSortNode(orderBy); attachLast(sortNode, plan); return sortNode; }
/** * Attach DUP_REMOVE node at top of tree. The DUP_REMOVE may be pushed down * to a source (or sources) if possible by the optimizer. * @param plan Existing plan * @return Updated plan */ private static PlanNode attachDupRemoval(PlanNode plan) { PlanNode dupNode = NodeFactory.getNewNode(NodeConstants.Types.DUP_REMOVE); attachLast(dupNode, plan); return dupNode; }
private static PlanNode attachProject(PlanNode plan, List<? extends Expression> select) { PlanNode projectNode = createProjectNode(select); attachLast(projectNode, plan); return projectNode; }
private static PlanNode attachProject(PlanNode plan, List<? extends Expression> select) { PlanNode projectNode = createProjectNode(select); attachLast(projectNode, plan); return projectNode; }
/** * Attach DUP_REMOVE node at top of tree. The DUP_REMOVE may be pushed down * to a source (or sources) if possible by the optimizer. * @param plan Existing plan * @return Updated plan */ private static PlanNode attachDupRemoval(PlanNode plan) { PlanNode dupNode = NodeFactory.getNewNode(NodeConstants.Types.DUP_REMOVE); attachLast(dupNode, plan); return dupNode; }
/** * Attach SORT node at top of tree. The SORT may be pushed down to a source (or sources) * if possible by the optimizer. * @param plan Existing plan * @param orderBy Sort description from the query * @return Updated plan */ private static PlanNode attachSorting(PlanNode plan, OrderBy orderBy) { PlanNode sortNode = createSortNode(orderBy); attachLast(sortNode, plan); return sortNode; }
/** * Attach all criteria above the join nodes. The optimizer will push these * criteria down to the appropriate source. * @param plan Existing plan, which joins all source groups * @param criteria Criteria from query * @return Updated tree */ private static PlanNode attachCriteria(PlanNode plan, Criteria criteria, boolean isHaving) { List<Criteria> crits = Criteria.separateCriteriaByAnd(criteria); for (Criteria crit : crits) { PlanNode critNode = createSelectNode(crit, isHaving); attachLast(critNode, plan); plan = critNode; } return plan; }
/** * Attach all criteria above the join nodes. The optimizer will push these * criteria down to the appropriate source. * @param plan Existing plan, which joins all source groups * @param criteria Criteria from query * @return Updated tree */ private static PlanNode attachCriteria(PlanNode plan, Criteria criteria, boolean isHaving) { List<Criteria> crits = Criteria.separateCriteriaByAnd(criteria); for (Criteria crit : crits) { PlanNode critNode = createSelectNode(crit, isHaving); attachLast(critNode, plan); plan = critNode; } return plan; }
/** * Attach all criteria above the join nodes. The optimizer will push these * criteria down to the appropriate source. * @param plan Existing plan, which joins all source groups * @param criteria Criteria from query * @return Updated tree */ private static PlanNode attachCriteria(PlanNode plan, Criteria criteria, boolean isHaving) { List<Criteria> crits = Criteria.separateCriteriaByAnd(criteria); for (Criteria crit : crits) { PlanNode critNode = createSelectNode(crit, isHaving); attachLast(critNode, plan); plan = critNode; } return plan; }
/** * Attach SORT node at top of tree. The SORT may be pushed down to a source (or sources) * if possible by the optimizer. * @param plan Existing plan * @param orderBy Sort description from the query * @return Updated plan */ private static PlanNode attachSorting(PlanNode plan, OrderBy orderBy) { PlanNode sortNode = NodeFactory.getNewNode(NodeConstants.Types.SORT); 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; }
node.setProperty(NodeConstants.Info.USE_ALL, query.isAll()); this.sourceHint = previous; attachLast(node, leftPlan); attachLast(node, rightPlan);
PlanNode createStoredProcedurePlan(StoredProcedure storedProc) throws QueryMetadataException, TeiidComponentException, TeiidProcessingException { // Create top project node - define output columns for stored query / procedure PlanNode projectNode = attachProject(null, storedProc.getProjectedSymbols()); // Define source of data for stored query / procedure PlanNode sourceNode = NodeFactory.getNewNode(NodeConstants.Types.SOURCE); sourceNode.setProperty(NodeConstants.Info.VIRTUAL_COMMAND, storedProc); addNestedProcedure(sourceNode, storedProc, storedProc.getProcedureID()); hints.hasRelationalProc |= storedProc.isProcedureRelational(); if (!hints.hasRowBasedSecurity && RowBasedSecurityHelper.applyRowSecurity(metadata, storedProc.getGroup(), context)) { hints.hasRowBasedSecurity = true; } // Set group on source node sourceNode.addGroup(storedProc.getGroup()); attachLast(projectNode, sourceNode); return projectNode; }
PlanNode createStoredProcedurePlan(StoredProcedure storedProc) throws QueryMetadataException, TeiidComponentException, TeiidProcessingException { // Create top project node - define output columns for stored query / procedure PlanNode projectNode = attachProject(null, storedProc.getProjectedSymbols()); // Define source of data for stored query / procedure PlanNode sourceNode = NodeFactory.getNewNode(NodeConstants.Types.SOURCE); sourceNode.setProperty(NodeConstants.Info.VIRTUAL_COMMAND, storedProc); addNestedProcedure(sourceNode, storedProc, storedProc.getProcedureID()); hints.hasRelationalProc |= storedProc.isProcedureRelational(); if (!hints.hasRowBasedSecurity && RowBasedSecurityHelper.applyRowSecurity(metadata, storedProc.getGroup(), context)) { hints.hasRowBasedSecurity = true; } // Set group on source node sourceNode.addGroup(storedProc.getGroup()); attachLast(projectNode, sourceNode); return projectNode; }
PlanNode createStoredProcedurePlan(StoredProcedure storedProc) throws QueryMetadataException, TeiidComponentException, TeiidProcessingException { // Create top project node - define output columns for stored query / procedure PlanNode projectNode = attachProject(null, storedProc.getProjectedSymbols()); // Define source of data for stored query / procedure PlanNode sourceNode = NodeFactory.getNewNode(NodeConstants.Types.SOURCE); sourceNode.setProperty(NodeConstants.Info.VIRTUAL_COMMAND, storedProc); addNestedProcedure(sourceNode, storedProc, storedProc.getProcedureID()); hints.hasRelationalProc |= storedProc.isProcedureRelational(); if (!hints.hasRowBasedSecurity && RowBasedSecurityHelper.applyRowSecurity(metadata, storedProc.getGroup(), context)) { hints.hasRowBasedSecurity = true; } // Set group on source node sourceNode.addGroup(storedProc.getGroup()); attachLast(projectNode, sourceNode); return projectNode; }
private static PlanNode attachTupleLimit(PlanNode plan, Limit limit, PlanHints hints) { hints.hasLimit = true; PlanNode limitNode = NodeFactory.getNewNode(NodeConstants.Types.TUPLE_LIMIT); boolean attach = false; if (limit.getOffset() != null) { limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, limit.getOffset()); attach = true; } if (limit.getRowLimit() != null) { limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, limit.getRowLimit()); attach = true; } if (attach) { if (limit.isImplicit()) { limitNode.setProperty(Info.IS_IMPLICIT_LIMIT, true); } if (!limit.isStrict()) { limitNode.setProperty(Info.IS_NON_STRICT, true); } attachLast(limitNode, plan); plan = limitNode; } return plan; }
private static PlanNode attachTupleLimit(PlanNode plan, Limit limit, PlanHints hints) { hints.hasLimit = true; PlanNode limitNode = NodeFactory.getNewNode(NodeConstants.Types.TUPLE_LIMIT); boolean attach = false; if (limit.getOffset() != null) { limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, limit.getOffset()); attach = true; } if (limit.getRowLimit() != null) { limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, limit.getRowLimit()); attach = true; } if (attach) { if (limit.isImplicit()) { limitNode.setProperty(Info.IS_IMPLICIT_LIMIT, true); } if (!limit.isStrict()) { limitNode.setProperty(Info.IS_NON_STRICT, true); } attachLast(limitNode, plan); plan = limitNode; } return plan; }
private static PlanNode attachTupleLimit(PlanNode plan, Limit limit, PlanHints hints) { hints.hasLimit = true; PlanNode limitNode = NodeFactory.getNewNode(NodeConstants.Types.TUPLE_LIMIT); boolean attach = false; if (limit.getOffset() != null) { limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, limit.getOffset()); attach = true; } if (limit.getRowLimit() != null) { limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, limit.getRowLimit()); attach = true; } if (attach) { if (limit.isImplicit()) { limitNode.setProperty(Info.IS_IMPLICIT_LIMIT, true); } if (!limit.isStrict()) { limitNode.setProperty(Info.IS_NON_STRICT, true); } attachLast(limitNode, plan); plan = limitNode; } return plan; }
context.accessedPlanningObject(id); attachLast(projectNode, sourceNode); if (insert.getQueryExpression() != null) { PlanNode plan = generatePlan(insert.getQueryExpression()); attachLast(sourceNode, plan); mergeTempMetadata(insert.getQueryExpression(), insert); projectNode.setProperty(NodeConstants.Info.INTO_GROUP, insert.getGroup());