Examples of ElementSymbol


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

  }   
   
    // special test for both sides are String
  @Test public void testStringConversion3() {
    // Expected left expression
    ElementSymbol e1 = new ElementSymbol("pm3.g1.e1"); //$NON-NLS-1$
    e1.setType(DataTypeManager.DefaultDataClasses.STRING);
        
    // Expected right expression
    Constant e2 = new Constant("2003-02-27"); //$NON-NLS-1$
        
    // Expected criteria
View Full Code Here

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

    assertEquals("Did not match expected criteria", expected, actual); //$NON-NLS-1$
 

    @Test public void testDateToTimestampConversion_defect9747() {
        // Expected left expression
        ElementSymbol e1 = new ElementSymbol("pm3.g1.e4"); //$NON-NLS-1$
        e1.setType(DataTypeManager.DefaultDataClasses.TIMESTAMP);
              
        // Expected right expression
        Constant e2 = new Constant(TimestampUtil.createDate(96, 0, 31), DataTypeManager.DefaultDataClasses.DATE);
        Function f1 = new Function("convert", new Expression[] { e2, new Constant(DataTypeManager.DefaultDataTypes.TIMESTAMP)}); //$NON-NLS-1$
        f1.makeImplicit();
View Full Code Here

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

    @Test public void test11716() throws Exception {
      String sql = "SELECT e1 FROM pm1.g1 where e1='1'"; //$NON-NLS-1$
      Map externalMetadata = new HashMap();
      GroupSymbol inputSet = new GroupSymbol("INPUT"); //$NON-NLS-1$
      List inputSetElements = new ArrayList();
      ElementSymbol inputSetElement = new ElementSymbol("INPUT.e1"); //$NON-NLS-1$
      inputSetElements.add(inputSetElement);
      externalMetadata.put(inputSet, inputSetElements);
        Query command = (Query)helpParse(sql);
        QueryResolver.resolveCommand(command, metadata);
        Collection groups = GroupCollectorVisitor.getGroups(command, false);
View Full Code Here

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

    @Test public void testDefect18832() {
        String sql = "SELECT * from (SELECT null as a, e1 FROM pm1.g1) b"; //$NON-NLS-1$
        Command c = helpResolve(sql);
        List projectedSymbols = c.getProjectedSymbols();
        for(int i=0; i< projectedSymbols.size(); i++) {
            ElementSymbol symbol = (ElementSymbol)projectedSymbols.get(i);
            assertTrue(!symbol.getType().equals(DataTypeManager.DefaultDataClasses.NULL));          
        }
    }
View Full Code Here

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

    public void testRecontextGroup11() {
        helpTestRecontextGroup("m.c.g", null, new String[] {"G__1" }, "g__2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }
 
    public void testConvertSubqueryCompareCriteria() throws Exception{
        ElementSymbol e1 = new ElementSymbol("e1"); //$NON-NLS-1$
        ElementSymbol x1 = new ElementSymbol("x1"); //$NON-NLS-1$
        Map<ElementSymbol, ElementSymbol> symbolMap = new HashMap<ElementSymbol, ElementSymbol>();
        symbolMap.put(e1, x1);
       
        Query query = new Query();
        SubqueryCompareCriteria crit = new SubqueryCompareCriteria(e1, query, SubqueryCompareCriteria.EQ, SubqueryCompareCriteria.ALL);
View Full Code Here

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

        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);
        es.setMetadataID(metadata.getElementID("xmltest.doc1.Catalogs.Catalog.Items.Item.Name")); //$NON-NLS-1$
    CompareCriteria crit = new CompareCriteria(es, CompareCriteria.EQ, new Constant("abc")); //$NON-NLS-1$
 
    helpTestMapping(crit, "xmltest.\"group\".items.itemName = 'abc'", mappingDoc, metadata); //$NON-NLS-1$
  }
View Full Code Here

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

    static class SourceFixer extends MappingVisitor{
        public void visit(MappingSourceNode sourceNode) {
            ResultSetInfo info = getResultInfo(sourceNode.getResultName());
            Map symbolMap = new HashMap();
            for (Iterator i = info.getCommand().getProjectedSymbols().iterator(); i.hasNext();) {
                ElementSymbol element = (ElementSymbol)i.next();
                symbolMap.put(element, element);
            }
            sourceNode.setSymbolMap(symbolMap);
            sourceNode.setResultSetInfo(info);
        }
View Full Code Here

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

    static class DummyCommand extends Command{
        List list = new ArrayList();

        DummyCommand(String groupName, String[] symbols){
            for (int i= 0; i < symbols.length; i++) {
                list.add(new ElementSymbol(groupName+"."+symbols[i])); //$NON-NLS-1$
            }
        }
View Full Code Here

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

   
        try {
            // Group pm1.g1
            FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("pm1.g1"); //$NON-NLS-1$
            List elementSymbols = new ArrayList(1);
            ElementSymbol count = new ElementSymbol("Count"); //$NON-NLS-1$
            count.setType(Integer.class);
            elementSymbols.add(count);
       
            dataMgr.registerTuples(
                groupID,
                elementSymbols,
View Full Code Here

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

        }
        SymbolMap symbolMap = (SymbolMap)sourceNode.getProperty(NodeConstants.Info.SYMBOL_MAP);
        for (Iterator i = accessPatterns.iterator(); i.hasNext();) {
            AccessPattern ap = (AccessPattern)i.next();
            for (Iterator elems = ap.getUnsatisfied().iterator(); elems.hasNext();) {
                ElementSymbol symbol = (ElementSymbol)elems.next();
                Expression mapped = convertExpression(symbol, symbolMap.asMap());
                if (ElementCollectorVisitor.getElements(mapped, true).isEmpty()) {
                    return false;
                }
            }
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.