Search in sources :

Example 16 with UnaryFromClause

use of org.teiid.query.sql.lang.UnaryFromClause in project teiid by teiid.

the class TestLimitParsing method testFetchFirst.

@Test
public void testFetchFirst() {
    Query query = new Query();
    Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
    // $NON-NLS-1$
    From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a"))));
    query.setSelect(select);
    query.setFrom(from);
    query.setLimit(new Limit(null, new Constant(2)));
    // $NON-NLS-1$ //$NON-NLS-2$
    helpTest("Select * from a fetch first 2 rows only", "SELECT * FROM a LIMIT 2", query);
}
Also used : MultipleElementSymbol(org.teiid.query.sql.symbol.MultipleElementSymbol) Query(org.teiid.query.sql.lang.Query) SetQuery(org.teiid.query.sql.lang.SetQuery) UnaryFromClause(org.teiid.query.sql.lang.UnaryFromClause) Constant(org.teiid.query.sql.symbol.Constant) Select(org.teiid.query.sql.lang.Select) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) From(org.teiid.query.sql.lang.From) Limit(org.teiid.query.sql.lang.Limit) Test(org.junit.Test)

Example 17 with UnaryFromClause

use of org.teiid.query.sql.lang.UnaryFromClause in project teiid by teiid.

the class TestGroupCollectorVisitor method testUnaryFromClause.

public void testUnaryFromClause() {
    GroupSymbol gs = exampleGroupSymbol(1);
    UnaryFromClause ufc = new UnaryFromClause(gs);
    Set groups = new HashSet();
    groups.add(gs);
    helpTestGroups(ufc, true, groups);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) UnaryFromClause(org.teiid.query.sql.lang.UnaryFromClause) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) HashSet(java.util.HashSet)

Example 18 with UnaryFromClause

use of org.teiid.query.sql.lang.UnaryFromClause in project teiid by teiid.

the class TestGroupCollectorVisitor method testJoinPredicate1.

public void testJoinPredicate1() {
    GroupSymbol gs1 = exampleGroupSymbol(1);
    GroupSymbol gs2 = exampleGroupSymbol(2);
    JoinPredicate jp = new JoinPredicate(new UnaryFromClause(gs1), new UnaryFromClause(gs2), JoinType.JOIN_CROSS);
    Set groups = new HashSet();
    groups.add(gs1);
    groups.add(gs2);
    helpTestGroups(jp, true, groups);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) UnaryFromClause(org.teiid.query.sql.lang.UnaryFromClause) JoinPredicate(org.teiid.query.sql.lang.JoinPredicate) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) HashSet(java.util.HashSet)

Example 19 with UnaryFromClause

use of org.teiid.query.sql.lang.UnaryFromClause in project teiid by teiid.

the class TestGroupCollectorVisitor method testJoinPredicate2.

public void testJoinPredicate2() {
    GroupSymbol gs1 = exampleGroupSymbol(1);
    GroupSymbol gs2 = exampleGroupSymbol(2);
    GroupSymbol gs3 = exampleGroupSymbol(3);
    JoinPredicate jp1 = new JoinPredicate(new UnaryFromClause(gs1), new UnaryFromClause(gs2), JoinType.JOIN_CROSS);
    JoinPredicate jp2 = new JoinPredicate(new UnaryFromClause(gs3), jp1, JoinType.JOIN_CROSS);
    Set groups = new HashSet();
    groups.add(gs1);
    groups.add(gs2);
    groups.add(gs3);
    helpTestGroups(jp2, true, groups);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) UnaryFromClause(org.teiid.query.sql.lang.UnaryFromClause) JoinPredicate(org.teiid.query.sql.lang.JoinPredicate) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) HashSet(java.util.HashSet)

Example 20 with UnaryFromClause

use of org.teiid.query.sql.lang.UnaryFromClause in project teiid by teiid.

the class TestAssignmentStatement method sample2.

public static final AssignmentStatement sample2() {
    Query query = new Query();
    // $NON-NLS-1$
    query.setSelect(new Select(Arrays.asList(new ElementSymbol("x"))));
    // $NON-NLS-1$
    query.setFrom(new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("y")))));
    // $NON-NLS-1$
    return new AssignmentStatement(new ElementSymbol("b"), query);
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Query(org.teiid.query.sql.lang.Query) UnaryFromClause(org.teiid.query.sql.lang.UnaryFromClause) AssignmentStatement(org.teiid.query.sql.proc.AssignmentStatement) Select(org.teiid.query.sql.lang.Select) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) From(org.teiid.query.sql.lang.From)

Aggregations

UnaryFromClause (org.teiid.query.sql.lang.UnaryFromClause)20 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)16 Query (org.teiid.query.sql.lang.Query)13 From (org.teiid.query.sql.lang.From)11 Select (org.teiid.query.sql.lang.Select)11 SetQuery (org.teiid.query.sql.lang.SetQuery)11 Test (org.junit.Test)10 Limit (org.teiid.query.sql.lang.Limit)10 MultipleElementSymbol (org.teiid.query.sql.symbol.MultipleElementSymbol)10 Constant (org.teiid.query.sql.symbol.Constant)8 Reference (org.teiid.query.sql.symbol.Reference)5 HashSet (java.util.HashSet)4 JoinPredicate (org.teiid.query.sql.lang.JoinPredicate)4 ArrayList (java.util.ArrayList)3 Set (java.util.Set)3 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)3 CompareCriteria (org.teiid.query.sql.lang.CompareCriteria)2 IOException (java.io.IOException)1 Clob (java.sql.Clob)1 SQLException (java.sql.SQLException)1