Search in sources :

Example 26 with GroupSymbol

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

the class TestCreate method sample2.

public static final Create sample2() {
    Create create = new Create();
    // $NON-NLS-1$
    create.setTable(new GroupSymbol("temp_table2"));
    List elements = new ArrayList();
    // $NON-NLS-1$
    elements.add(new ElementSymbol("a"));
    // $NON-NLS-1$
    elements.add(new ElementSymbol("b"));
    create.setElementSymbolsAsColumns(elements);
    return create;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Create(org.teiid.query.sql.lang.Create) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 27 with GroupSymbol

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

the class TestGroupCollectorVisitor method testUpdate.

public void testUpdate() {
    GroupSymbol gs1 = exampleGroupSymbol(1);
    Update update = new Update();
    update.setGroup(gs1);
    Set groups = new HashSet();
    groups.add(gs1);
    helpTestGroups(update, true, groups);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) Update(org.teiid.query.sql.lang.Update) HashSet(java.util.HashSet)

Example 28 with GroupSymbol

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

the class TestGroupCollectorVisitor method testFrom1.

public void testFrom1() {
    GroupSymbol gs1 = exampleGroupSymbol(1);
    GroupSymbol gs2 = exampleGroupSymbol(2);
    GroupSymbol gs3 = exampleGroupSymbol(3);
    From from = new From();
    from.addGroup(gs1);
    from.addGroup(gs2);
    from.addGroup(gs3);
    Set groups = new HashSet();
    groups.add(gs1);
    groups.add(gs2);
    groups.add(gs3);
    helpTestGroups(from, true, groups);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) From(org.teiid.query.sql.lang.From) HashSet(java.util.HashSet)

Example 29 with GroupSymbol

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

the class TestGroupCollectorVisitor method testBatchedUpdateCommand.

public void testBatchedUpdateCommand() {
    GroupSymbol g1 = exampleGroupSymbol(1);
    GroupSymbol g2 = exampleGroupSymbol(2);
    GroupSymbol g3 = exampleGroupSymbol(3);
    Insert insert = new Insert();
    insert.setGroup(g1);
    Update update = new Update();
    update.setGroup(g2);
    Delete delete = new Delete();
    delete.setGroup(g3);
    List updates = new ArrayList(3);
    updates.add(insert);
    updates.add(update);
    updates.add(delete);
    Set groups = new HashSet();
    groups.add(g1);
    groups.add(g2);
    groups.add(g3);
    helpTestGroups(new BatchedUpdateCommand(updates), true, groups);
}
Also used : Delete(org.teiid.query.sql.lang.Delete) Set(java.util.Set) HashSet(java.util.HashSet) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Insert(org.teiid.query.sql.lang.Insert) Update(org.teiid.query.sql.lang.Update) BatchedUpdateCommand(org.teiid.query.sql.lang.BatchedUpdateCommand) HashSet(java.util.HashSet)

Example 30 with GroupSymbol

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

the class TestSetQuery method test2.

public void test2() {
    Query q1 = new Query();
    Select select = new Select();
    // $NON-NLS-1$
    select.addSymbol(new ElementSymbol("x"));
    q1.setSelect(select);
    From from = new From();
    // $NON-NLS-1$
    from.addGroup(new GroupSymbol("g"));
    q1.setFrom(from);
    Query q2 = new Query();
    select = new Select();
    // $NON-NLS-1$
    select.addSymbol(new ElementSymbol("y"));
    q2.setSelect(select);
    from = new From();
    // $NON-NLS-1$
    from.addGroup(new GroupSymbol("h"));
    q2.setFrom(from);
    SetQuery sq = new SetQuery(Operation.INTERSECT);
    sq.setAll(false);
    sq.setLeftQuery(q1);
    sq.setRightQuery(q2);
    assertEquals(// $NON-NLS-1$
    "Query combiner string doesn't match expected: ", // $NON-NLS-1$
    "SELECT x FROM g INTERSECT SELECT y FROM h", sq.toString());
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol)

Aggregations

GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)299 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)146 Test (org.junit.Test)108 ArrayList (java.util.ArrayList)92 MultipleElementSymbol (org.teiid.query.sql.symbol.MultipleElementSymbol)59 Expression (org.teiid.query.sql.symbol.Expression)52 PlanNode (org.teiid.query.optimizer.relational.plantree.PlanNode)50 Constant (org.teiid.query.sql.symbol.Constant)48 List (java.util.List)43 HashSet (java.util.HashSet)32 Query (org.teiid.query.sql.lang.Query)31 From (org.teiid.query.sql.lang.From)29 SymbolMap (org.teiid.query.sql.util.SymbolMap)29 Select (org.teiid.query.sql.lang.Select)26 Criteria (org.teiid.query.sql.lang.Criteria)22 TempMetadataID (org.teiid.query.metadata.TempMetadataID)21 LinkedList (java.util.LinkedList)20 Command (org.teiid.query.sql.lang.Command)20 Set (java.util.Set)17 CompareCriteria (org.teiid.query.sql.lang.CompareCriteria)17