Package org.teiid.query.sql.util

Examples of org.teiid.query.sql.util.SymbolMap


        //create the correlated refs if they exist
        //there is a little bit of a design problem here that null usually means no refs.
        ArrayList<Reference> correlatedReferences = new ArrayList<Reference>();
        CorrelatedReferenceCollectorVisitor.collectReferences(plannedResult.query, groups, correlatedReferences);
        if (!correlatedReferences.isEmpty()) {
                SymbolMap map = new SymbolMap();
                for (Reference reference : correlatedReferences) {
            map.addMapping(reference.getExpression(), reference.getExpression());
          }
                plannedResult.query.setCorrelatedReferences(map);
           
      }
      boolean requiresDistinct = requiresDistinctRows(query);
View Full Code Here


      update.setUpdateInfo(ProcedureContainerResolver.getUpdateInfo(update.getGroup(), metadata, Command.TYPE_UPDATE));
      return rewriteUpdate(update);
    }
    Query query = (Query)info.getViewDefinition().clone();
    query.setOrderBy(null);
    SymbolMap expressionMapping = SymbolMap.createSymbolMap(update.getGroup(), query.getProjectedSymbols(), metadata);
   
    ArrayList<SingleElementSymbol> selectSymbols = mapChangeList(update, symbolMap);
    query.setSelect(new Select(selectSymbols));
    ExpressionMappingVisitor emv = new ExpressionMappingVisitor(expressionMapping.asMap(), true);
    PostOrderNavigator.doVisit(query.getSelect(), emv);
   
    Criteria crit = update.getCriteria();
    if (crit != null) {
      PostOrderNavigator.doVisit(crit, emv);
View Full Code Here

      return rewriteDelete(delete);
    }
   
    Query query = (Query)info.getViewDefinition().clone();
    query.setOrderBy(null);
    SymbolMap expressionMapping = SymbolMap.createSymbolMap(delete.getGroup(), query.getProjectedSymbols(), metadata);
   
    query.setSelect(new Select());
    ExpressionMappingVisitor emv = new ExpressionMappingVisitor(expressionMapping.asMap(), true);
   
    Criteria crit = delete.getCriteria();
    if (crit != null) {
      PostOrderNavigator.doVisit(crit, emv);
      query.setCriteria(Criteria.combineCriteria(query.getCriteria(), crit));
View Full Code Here

      if (containers.isEmpty()) {
        return Collections.emptyList();
      }
      ArrayList<SymbolMap> result = new ArrayList<SymbolMap>(containers.size());
      for (SubqueryContainer container : containers) {
        SymbolMap map = container.getCommand().getCorrelatedReferences();
      if (map != null) {
        result.add(map);
      }
    }
      return result;
View Full Code Here

      if (type != NodeConstants.Types.JOIN) {
        return Collections.emptyList();
      }
      LinkedList<SymbolMap> result = new LinkedList<SymbolMap>();
    for (PlanNode child : NodeEditor.findAllNodes(this, NodeConstants.Types.SOURCE, NodeConstants.Types.ACCESS)) {
      SymbolMap references = (SymbolMap)child.getProperty(NodeConstants.Info.CORRELATED_REFERENCES);
          if (references == null) {
            continue;
          }
          Set<GroupSymbol> correlationGroups = GroupsUsedByElementsVisitor.getGroups(references.getValues());
          PlanNode joinNode = NodeEditor.findParent(child, NodeConstants.Types.JOIN, NodeConstants.Types.SOURCE);
          while (joinNode != null) {
            if (joinNode.getGroups().containsAll(correlationGroups)) {
              if (joinNode == this) {
                result.add(references);
View Full Code Here

              }
            }
          }
      this.subqueries.put(key, state);
    }
    SymbolMap correlatedRefs = container.getCommand().getCorrelatedReferences();
    VariableContext currentContext = null;
    boolean shouldClose = state.done && state.nonDeterministic;
    if (correlatedRefs != null) {
            currentContext = new VariableContext();
            for (Map.Entry<ElementSymbol, Expression> entry : container.getCommand().getCorrelatedReferences().asMap().entrySet()) {
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.util.SymbolMap

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.