Package org.teiid.query.sql.symbol

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


            final String sql = expectedAtomic[i];
            Command command;
            try {
                command = helpGetCommand(sql, md, null);
                Collection groups = GroupCollectorVisitor.getGroupsIgnoreInlineViews(command, false);
                final GroupSymbol symbol = (GroupSymbol)groups.iterator().next();
                Object modelId = md.getModelID(symbol.getMetadataID());
                boolean supportsGroupAliases = CapabilitiesUtil.supportsGroupAliases(modelId, md, capFinder);
                boolean supportsProjection = CapabilitiesUtil.supports(Capability.QUERY_SELECT_EXPRESSION, modelId, md, capFinder);
                command.acceptVisitor(new AliasGenerator(supportsGroupAliases, !supportsProjection));
                expectedQueries.add(command.toString());
            } catch (Exception err) {
View Full Code Here


            this.getResultSetInfo().setMappingClassSymbol(getMappedSymbol(mappingClassSymbol));
        }
    }
   
    public String getActualResultSetName() {
        GroupSymbol group = getMappedSymbol(new GroupSymbol(getResultName()));
        return group.getName();
    }
View Full Code Here

       
        return mappedSymbol;
    }

    public GroupSymbol getMappedSymbol(GroupSymbol symbol) {
        GroupSymbol mappedSymbol = (GroupSymbol)symbolMap.get(symbol);
        if (mappedSymbol == null) {
            MappingSourceNode parentSourceNode = getParentSourceNode();
            if (parentSourceNode != null) {
                return parentSourceNode.getMappedSymbol(symbol);
            }
View Full Code Here

    public TestUpdateImpl(String name) {
        super(name);
    }
   
    public static org.teiid.query.sql.lang.Update helpExample() {
        GroupSymbol group = TestGroupImpl.helpExample("vm1.g1"); //$NON-NLS-1$
        org.teiid.query.sql.lang.Update result = new org.teiid.query.sql.lang.Update();
        result.setGroup(group);
        result.addChange(TestElementImpl.helpExample("vm1.g1", "e1"), new Constant(new Integer(1)));
        result.addChange(TestElementImpl.helpExample("vm1.g1", "e2"), new Constant(new Integer(1)));
        result.addChange(TestElementImpl.helpExample("vm1.g1", "e3"), new Constant(new Integer(1)));
View Full Code Here

        ProjectIntoNode node = new ProjectIntoNode(2);
       
        TupleSource tupleSource =  new FakeDataTupleSource(NUM_ROWS);
        RelationalNode child = new FakeRelationalNode(1,tupleSource, tupleBatchSize);
        node.addChild(child);
        node.setIntoGroup(new GroupSymbol("myGroup")); //$NON-NLS-1$
        ElementSymbol elementSymbol_1 = new ElementSymbol("myGroup.myElement1"); //$NON-NLS-1$
        ElementSymbol elementSymbol_2 = new ElementSymbol("myGroup.myElement2"); //$NON-NLS-1$
        elementSymbol_1.setType(Integer.class);
        elementSymbol_2.setType(String.class);
        ArrayList elements = new ArrayList();
View Full Code Here

                node.setProperty(Info.EST_COL_STATS, colStats);
                }
              }
          }
        }else {
            GroupSymbol group = node.getGroups().iterator().next();
            float cardinality = metadata.getCardinality(group.getMetadataID());
            if (cardinality <= QueryMetadataInterface.UNKNOWN_CARDINALITY){
                cardinality = UNKNOWN_VALUE;
            }
            cost = cardinality;
            if (!node.hasProperty(Info.ATOMIC_REQUEST)) {
View Full Code Here

          Expression ex = SymbolMap.getExpression(ses);
          if (!(ex instanceof ElementSymbol)) {
            continue; //TODO: function based indexes are possible, but we don't have the metadata
          }
          ElementSymbol element = (ElementSymbol)ex;
            GroupSymbol group = element.getGroupSymbol();
            if (groups != null && !groups.contains(group)) {
              continue;
            }
            List<Object> elements = groupMap.get(group);
            if(elements == null) {
                elements = new ArrayList<Object>();
                groupMap.put(group, elements);
            }
            elements.add(element.getMetadataID());
        }   
            
        // Walk through each group
        for (Map.Entry<GroupSymbol, List<Object>> entry : groupMap.entrySet()) {
            GroupSymbol group = entry.getKey();
            List<Object> elements = entry.getValue();
           
            // Look up keys
            Collection keys = null;
            if ((unique != null && unique) || unique == null) {
              keys = metadata.getUniqueKeysInGroup(group.getMetadataID());
            }
            if ((unique != null && !unique) || unique == null) {
              if (keys != null) {
                keys = new ArrayList<Object>(keys);
              } else {
                keys = new ArrayList<Object>(2);
              }
              keys.addAll(metadata.getIndexesInGroup(group.getMetadataID()));
            }
           
            if(keys != null && keys.size() > 0) {
                // For each key, get key elements
              for (Object key : keys) {
View Full Code Here

        Object obj = new FakeMetadataObject(name, FakeMetadataObject.GROUP);
        return helpExample(groupName, definition, obj);
    }
   
    public static GroupSymbol helpExample(String groupName, String definition, Object metadataID) {
        GroupSymbol symbol = new GroupSymbol(groupName, definition);
        symbol.setMetadataID(metadataID);
        return symbol;
    }
View Full Code Here

    }

    public void updateSymbolMapDependentValues() {
        // based on the symbol map modify the getalias name
        if (getAliasResultName() != null) {
            GroupSymbol newGroup = getMappedSymbol(new GroupSymbol(getAliasResultName()));
            setAliasResultName(newGroup.getName());
        }
       
        ElementSymbol mappingClassSymbol = this.getResultSetInfo().getMappingClassSymbol();
       
        if (mappingClassSymbol != null) {
View Full Code Here

    public TestInsertImpl(String name) {
        super(name);
    }

    public static org.teiid.query.sql.lang.Insert helpExample(String groupName) {
        GroupSymbol group = TestGroupImpl.helpExample(groupName);
        ArrayList<ElementSymbol> elements = new ArrayList<ElementSymbol>();
        elements.add(TestElementImpl.helpExample(groupName, "e1")); //$NON-NLS-1$
        elements.add(TestElementImpl.helpExample(groupName, "e2")); //$NON-NLS-1$
        elements.add(TestElementImpl.helpExample(groupName, "e3")); //$NON-NLS-1$
        elements.add(TestElementImpl.helpExample(groupName, "e4")); //$NON-NLS-1$
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.