Package org.teiid.query.sql.symbol

Examples of org.teiid.query.sql.symbol.GroupSymbol


  public TestContextReplacerVisitor(String name) {
      super(name);
 
 
  public GroupSymbol exampleGroupSymbol(int number) {
    return new GroupSymbol("group." + number); //$NON-NLS-1$
  }
View Full Code Here


     */
    public void testAddAccessPatterns2() throws Exception {
        Query query = new Query();
       
        From from = new From();
        GroupSymbol group = new GroupSymbol("pm4.g2"); //$NON-NLS-1$
        from.addGroup(group);
        query.setFrom(from);
       
        Select select = new Select();
        select.addSymbol(new AllSymbol());
        query.setSelect(select);

        group.setMetadataID(METADATA.getGroupID("pm4.g2")); //$NON-NLS-1$
               
        PlanNode n1 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
        n1.setProperty(NodeConstants.Info.ATOMIC_REQUEST, query);
        n1.addGroup(group);
       
View Full Code Here

 
     
  public void testMappingCriteria() throws Exception {
        FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadata();

        GroupSymbol doc = new GroupSymbol("xmltest.doc1"); //$NON-NLS-1$
        doc.setMetadataID(metadata.getGroupID(doc.getName()));
           

        MappingDocument mappingDoc = (MappingDocument)metadata.getMappingNode(doc.getMetadataID());
        mappingDoc = SourceNodeGenaratorVisitor.extractSourceNodes(mappingDoc);
   
    // Create criteria
         ElementSymbol es = new ElementSymbol("Catalogs.Catalog.Items.Item.Name"); //$NON-NLS-1$
        es.setGroupSymbol(doc);
View Full Code Here

    static PlanNode doMerge(PlanNode frame,
                            PlanNode root, boolean beforeDecomposeJoin,
                            QueryMetadataInterface metadata) throws QueryPlannerException, QueryMetadataException, TeiidComponentException {

        GroupSymbol virtualGroup = frame.getGroups().iterator().next();

        // check to see if frame represents a proc relational query.
        if (virtualGroup.isProcedure()) {
            return root;
        }
       
        SymbolMap references = (SymbolMap)frame.getProperty(NodeConstants.Info.CORRELATED_REFERENCES);
        if (references != null) {
          return root; //correlated nested table commands should not be merged
        }

        PlanNode parentProject = NodeEditor.findParent(frame, NodeConstants.Types.PROJECT);

        // Check whether the upper frame is a SELECT INTO
        if (parentProject.getProperty(NodeConstants.Info.INTO_GROUP) != null) {
            return root;
        }

        if (!FrameUtil.canConvertAccessPatterns(frame)) {
            return root;
        }

        PlanNode projectNode = frame.getFirstChild();

        // Check if lower frame has only a stored procedure execution - this cannot be merged to parent frame
        if (FrameUtil.isProcedure(projectNode)) {
            return root;
        }
       
        SymbolMap symbolMap = (SymbolMap)frame.getProperty(NodeConstants.Info.SYMBOL_MAP);
       
        PlanNode sortNode = NodeEditor.findParent(parentProject, NodeConstants.Types.SORT, NodeConstants.Types.SOURCE);
       
        if (sortNode != null && sortNode.hasBooleanProperty(NodeConstants.Info.UNRELATED_SORT)) {
          OrderBy sortOrder = (OrderBy)sortNode.getProperty(NodeConstants.Info.SORT_ORDER);
          boolean unrelated = false;
          for (OrderByItem item : sortOrder.getOrderByItems()) {
            if (!item.isUnrelated()) {
              continue;
            }
            Collection<ElementSymbol> elements = ElementCollectorVisitor.getElements(item.getSymbol(), true);
            for (ElementSymbol elementSymbol : elements) {
          if (virtualGroup.equals(elementSymbol.getGroupSymbol())) {
            unrelated = true;
            if (!(symbolMap.getMappedExpression(elementSymbol) instanceof ElementSymbol)) {
              return root;
            }
          }
View Full Code Here

    XMLPlannerEnvironment getEnv(String sql) throws Exception{
        FakeMetadataFacade metadata = TestXMLProcessor.exampleMetadataCached();
        Query query = (Query)TestXMLProcessor.helpGetCommand(sql, metadata);

        Collection groups = GroupCollectorVisitor.getGroups(query, true);
        GroupSymbol group = (GroupSymbol) groups.iterator().next();
       
        MappingDocument docOrig = (MappingDocument)metadata.getMappingNode(metadata.getGroupID(group.getName()));
        MappingDocument doc = (MappingDocument)docOrig.clone();

        XMLPlannerEnvironment env = new XMLPlannerEnvironment(metadata);
        env.mappingDoc = doc;
       
View Full Code Here

            } else if (RuleRaiseAccess.getModelIDFromAccess(accessNode, metadata) == null) {
              //with query
              accessNode.setProperty(NodeConstants.Info.IS_COMMON_TABLE, Boolean.TRUE);
            } else if(command == null) {
              PlanNode commandRoot = accessNode;
              GroupSymbol intoGroup = (GroupSymbol)accessNode.getFirstChild().getProperty(NodeConstants.Info.INTO_GROUP);
              if (intoGroup != null) {
                commandRoot = NodeEditor.findNodePreOrder(accessNode, NodeConstants.Types.SOURCE).getFirstChild();
              }
                plan = removeUnnecessaryInlineView(plan, commandRoot);
                QueryCommand queryCommand = createQuery(metadata, capFinder, accessNode, commandRoot);
View Full Code Here

              if (Boolean.TRUE.equals(node.getProperty(NodeConstants.Info.INLINE_VIEW))) {
                    PlanNode child = node.getFirstChild();
                    QueryCommand newQuery = createQuery(metadata, capFinder, accessRoot, child);
                   
                    //ensure that the group is consistent
                    GroupSymbol symbol = node.getGroups().iterator().next();
                    SubqueryFromClause sfc = new SubqueryFromClause(symbol, newQuery);
                    query.getFrom().addClause(sfc);
                    return;
                }
                query.getFrom().addGroup(node.getGroups().iterator().next());
View Full Code Here

    }
 
    @Test public void testShouldExecuteUpdate() throws Exception {
        Update update = new Update();
       
        update.setGroup(new GroupSymbol("test")); //$NON-NLS-1$
       
        update.addChange(new ElementSymbol("e1"), new Constant("1")); //$NON-NLS-1$ //$NON-NLS-2$
       
        assertTrue(RelationalNodeUtil.shouldExecute(update, false));
       
View Full Code Here

@SuppressWarnings("nls")
public class TestOptionsAndHints {
   
    /*+* Select a From db.g1 MAKENOTDEP, db.g2 MAKENOTDEP WHERE a = b */
    @Test public void testOptionMakeNotDepInline4(){
        GroupSymbol g1 = new GroupSymbol("db.g1"); //$NON-NLS-1$
        GroupSymbol g2 = new GroupSymbol("c", "db.g2"); //$NON-NLS-1$ //$NON-NLS-2$
        ElementSymbol a = new ElementSymbol("a")//$NON-NLS-1$
        ElementSymbol b = new ElementSymbol("b")//$NON-NLS-1$
       
        CompareCriteria crit = new CompareCriteria(a, CompareCriteria.EQ, b);
       
View Full Code Here

                 query);
    }

    /*+* Select a From db.g1 JOIN db.g2 MAKEDEP ON a = b */
    @Test public void testOptionMakeDepInline1(){
        GroupSymbol g1 = new GroupSymbol("db.g1"); //$NON-NLS-1$
        GroupSymbol g2 = new GroupSymbol("db.g2"); //$NON-NLS-1$
        ElementSymbol a = new ElementSymbol("a")//$NON-NLS-1$
        ElementSymbol b = new ElementSymbol("b")//$NON-NLS-1$
       
        List crits = new ArrayList();
        crits.add(new CompareCriteria(a, CompareCriteria.EQ, b));
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.symbol.GroupSymbol

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.