use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestOptionsAndHints method testOptionMakeNotDepInline4.
/*+* Select a From db.g1 MAKENOTDEP, db.g2 MAKENOTDEP WHERE a = b */
@Test
public void testOptionMakeNotDepInline4() {
// $NON-NLS-1$
GroupSymbol g1 = new GroupSymbol("db.g1");
// $NON-NLS-1$ //$NON-NLS-2$
GroupSymbol g2 = new GroupSymbol("c", "db.g2");
// $NON-NLS-1$
ElementSymbol a = new ElementSymbol("a");
// $NON-NLS-1$
ElementSymbol b = new ElementSymbol("b");
CompareCriteria crit = new CompareCriteria(a, CompareCriteria.EQ, b);
From from = new From();
FromClause clause = new UnaryFromClause(g1);
clause.setMakeNotDep(true);
from.addClause(clause);
FromClause clause1 = new UnaryFromClause(g2);
clause1.setMakeNotDep(true);
from.addClause(clause1);
Select select = new Select();
select.addSymbol(a);
Query query = new Query();
query.setSelect(select);
query.setFrom(from);
query.setCriteria(crit);
// $NON-NLS-1$
TestParser.helpTest(// $NON-NLS-1$
"Select a From db.g1 MAKENOTDEP, db.g2 AS c MAKENOTDEP WHERE a = b", // $NON-NLS-1$
"SELECT a FROM /*+ MAKENOTDEP */ db.g1, /*+ MAKENOTDEP */ db.g2 AS c WHERE a = b", query);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestOptionsAndHints method testOptionNoCache1.
@Test
public void testOptionNoCache1() {
// $NON-NLS-1$
GroupSymbol g = new GroupSymbol("db.g");
From from = new From();
from.addGroup(g);
Select select = new Select();
// $NON-NLS-1$
ElementSymbol a = new ElementSymbol("a");
select.addSymbol(a);
Option option = new Option();
option.setNoCache(true);
// $NON-NLS-1$
option.addNoCacheGroup("a.b.c");
Query query = new Query();
query.setSelect(select);
query.setFrom(from);
query.setOption(option);
// $NON-NLS-1$
TestParser.helpTest(// $NON-NLS-1$
"Select a From db.g Option nocache a.b.c", // $NON-NLS-1$
"SELECT a FROM db.g OPTION NOCACHE a.b.c", query);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestOptionsAndHints method testOptionMakeDependent2.
/*+* Select a From db.g Option makedep a.b.c, d.e.f showplan */
@Test
public void testOptionMakeDependent2() {
// $NON-NLS-1$
GroupSymbol g = new GroupSymbol("db.g");
From from = new From();
from.addGroup(g);
Select select = new Select();
// $NON-NLS-1$
ElementSymbol a = new ElementSymbol("a");
select.addSymbol(a);
Option option = new Option();
// $NON-NLS-1$
option.addDependentGroup("a.b.c");
// $NON-NLS-1$
option.addDependentGroup("d.e.f");
Query query = new Query();
query.setSelect(select);
query.setFrom(from);
query.setOption(option);
// $NON-NLS-1$
TestParser.helpTest(// $NON-NLS-1$
"Select a From db.g Option makedep a.b.c, d.e.f", // $NON-NLS-1$
"SELECT a FROM db.g OPTION MAKEDEP a.b.c, d.e.f", query);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestOptionsAndHints method testOptionalFromClause1_4.
@Test
public void testOptionalFromClause1_4() {
// $NON-NLS-1$
String sql = "SELECT * /*+ optional */ 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.GroupSymbol in project teiid by teiid.
the class TestOptionsAndHints method testOptionMakeNotDepInline1.
/*+* Select a From db.g1 JOIN db.g2 MAKENOTDEP ON a = b */
@Test
public void testOptionMakeNotDepInline1() {
// $NON-NLS-1$
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");
List<Object> crits = new ArrayList<Object>();
crits.add(new CompareCriteria(a, CompareCriteria.EQ, b));
JoinPredicate jp = new JoinPredicate(new UnaryFromClause(g1), new UnaryFromClause(g2), JoinType.JOIN_INNER, crits);
jp.getRightClause().setMakeNotDep(true);
From from = new From();
from.addClause(jp);
Select select = new Select();
select.addSymbol(a);
Query query = new Query();
query.setSelect(select);
query.setFrom(from);
// $NON-NLS-1$
TestParser.helpTest(// $NON-NLS-1$
"Select a From db.g1 JOIN db.g2 MAKENOTDEP ON a = b", // $NON-NLS-1$
"SELECT a FROM db.g1 INNER JOIN /*+ MAKENOTDEP */ db.g2 ON a = b", query);
}
Aggregations