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);
}
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);
}
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());
}
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());
}
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());
}
Aggregations