Search in sources :

Example 36 with MultipleElementSymbol

use of org.teiid.query.sql.symbol.MultipleElementSymbol in project teiid by teiid.

the class TestOptionsAndHints method testOptionalFromClause1.

@Test
public void testOptionalFromClause1() {
    // $NON-NLS-1$
    String sql = "SELECT * FROM /*+ optional */ t1, t2";
    Query query = new Query();
    Select select = new Select();
    select.addSymbol(new MultipleElementSymbol());
    query.setSelect(select);
    From from = new From();
    UnaryFromClause ufc = new UnaryFromClause();
    // $NON-NLS-1$
    ufc.setGroup(new GroupSymbol("t1"));
    ufc.setOptional(true);
    from.addClause(ufc);
    // $NON-NLS-1$
    from.addGroup(new GroupSymbol("t2"));
    query.setFrom(from);
    // $NON-NLS-1$
    TestParser.helpTest(sql, "SELECT * FROM /*+ optional */ t1, t2", query);
}
Also used : MultipleElementSymbol(org.teiid.query.sql.symbol.MultipleElementSymbol) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) Test(org.junit.Test)

Example 37 with MultipleElementSymbol

use of org.teiid.query.sql.symbol.MultipleElementSymbol in project teiid by teiid.

the class TestOptionsAndHints method testCache.

@Test
public void testCache() {
    // $NON-NLS-1$
    String sql = "/*+ cache */ SELECT * FROM t1";
    Query query = new Query();
    Select select = new Select();
    select.addSymbol(new MultipleElementSymbol());
    query.setSelect(select);
    From from = new From();
    UnaryFromClause ufc = new UnaryFromClause();
    from.addClause(ufc);
    // $NON-NLS-1$
    ufc.setGroup(new GroupSymbol("t1"));
    query.setFrom(from);
    query.setCacheHint(new CacheHint());
    // $NON-NLS-1$
    TestParser.helpTest(sql, "/*+ cache */ SELECT * FROM t1", query);
}
Also used : MultipleElementSymbol(org.teiid.query.sql.symbol.MultipleElementSymbol) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) Test(org.junit.Test)

Example 38 with MultipleElementSymbol

use of org.teiid.query.sql.symbol.MultipleElementSymbol in project teiid by teiid.

the class TestStaticSymbolMappingVisitor method testVisitMultipleElementSymbol.

public void testVisitMultipleElementSymbol() {
    // $NON-NLS-1$
    MultipleElementSymbol aigs = new MultipleElementSymbol("OLDG0.*");
    ArrayList elements = new ArrayList();
    elements.add(exampleElement(true, 0));
    elements.add(exampleElement(true, 1));
    aigs.setElementSymbols(elements);
    helpTest(aigs, getSymbolMap());
}
Also used : MultipleElementSymbol(org.teiid.query.sql.symbol.MultipleElementSymbol) ArrayList(java.util.ArrayList)

Example 39 with MultipleElementSymbol

use of org.teiid.query.sql.symbol.MultipleElementSymbol in project teiid by teiid.

the class TestStaticSymbolMappingVisitor method testMapMultipleElementSymbolName.

public void testMapMultipleElementSymbolName() {
    // $NON-NLS-1$
    MultipleElementSymbol aigs = new MultipleElementSymbol("OLDG0");
    ArrayList<ElementSymbol> elements = new ArrayList<ElementSymbol>();
    elements.add(exampleElement(true, 0));
    elements.add(exampleElement(true, 1));
    aigs.setElementSymbols(elements);
    // Run symbol mapper
    StaticSymbolMappingVisitor visitor = new StaticSymbolMappingVisitor(getSymbolMap());
    DeepPreOrderNavigator.doVisit(aigs, visitor);
    // Check name of all in group symbol
    // $NON-NLS-1$ //$NON-NLS-2$
    assertEquals("MultipleElementSymbol name did not get mapped correctly: ", "NEWG0.*", aigs.toString());
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) MultipleElementSymbol(org.teiid.query.sql.symbol.MultipleElementSymbol) MultipleElementSymbol(org.teiid.query.sql.symbol.MultipleElementSymbol) ArrayList(java.util.ArrayList)

Example 40 with MultipleElementSymbol

use of org.teiid.query.sql.symbol.MultipleElementSymbol in project teiid by teiid.

the class TestStaticSymbolMappingVisitor method testVisitSelect3.

public void testVisitSelect3() {
    Select select = new Select();
    MultipleElementSymbol all = new MultipleElementSymbol();
    all.addElementSymbol(exampleElement(true, 0));
    select.addSymbol(all);
    helpTest(select, getSymbolMap());
}
Also used : MultipleElementSymbol(org.teiid.query.sql.symbol.MultipleElementSymbol) Select(org.teiid.query.sql.lang.Select)

Aggregations

MultipleElementSymbol (org.teiid.query.sql.symbol.MultipleElementSymbol)41 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)29 Test (org.junit.Test)27 Select (org.teiid.query.sql.lang.Select)19 Query (org.teiid.query.sql.lang.Query)14 From (org.teiid.query.sql.lang.From)12 SetQuery (org.teiid.query.sql.lang.SetQuery)11 ArrayList (java.util.ArrayList)10 Limit (org.teiid.query.sql.lang.Limit)10 UnaryFromClause (org.teiid.query.sql.lang.UnaryFromClause)10 Constant (org.teiid.query.sql.symbol.Constant)7 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)7 Reference (org.teiid.query.sql.symbol.Reference)5 List (java.util.List)3 Expression (org.teiid.query.sql.symbol.Expression)2 Collection (java.util.Collection)1 QueryValidatorException (org.teiid.api.exception.query.QueryValidatorException)1 MultiSourceElement (org.teiid.dqp.internal.process.multisource.MultiSourceElement)1 TempMetadataID (org.teiid.query.metadata.TempMetadataID)1 PlanNode (org.teiid.query.optimizer.relational.plantree.PlanNode)1