Search in sources :

Example 66 with ElementSymbol

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

the class TestLoopStatement method query1.

// ################################## TEST HELPERS ################################
public static final Query query1() {
    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);
    return q1;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Query(org.teiid.query.sql.lang.Query) TestSetQuery(org.teiid.query.sql.lang.TestSetQuery) Select(org.teiid.query.sql.lang.Select) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) From(org.teiid.query.sql.lang.From)

Example 67 with ElementSymbol

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

the class TestLoopStatement method query2.

public static final Query query2() {
    Query q1 = new Query();
    Select select = new Select();
    // $NON-NLS-1$
    select.addSymbol(new ElementSymbol("x2"));
    q1.setSelect(select);
    From from = new From();
    // $NON-NLS-1$
    from.addGroup(new GroupSymbol("g2"));
    q1.setFrom(from);
    return q1;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Query(org.teiid.query.sql.lang.Query) TestSetQuery(org.teiid.query.sql.lang.TestSetQuery) Select(org.teiid.query.sql.lang.Select) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) From(org.teiid.query.sql.lang.From)

Example 68 with ElementSymbol

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

the class TestDynamicCommand method testClone1.

public void testClone1() {
    List symbols = new ArrayList();
    // $NON-NLS-1$
    ElementSymbol a1 = new ElementSymbol("a1");
    a1.setType(DataTypeManager.DefaultDataClasses.STRING);
    symbols.add(a1);
    DynamicCommand sqlCmd = new DynamicCommand();
    // $NON-NLS-1$
    Expression sql = new Constant("SELECT a1 FROM g WHERE a2 = 5");
    sqlCmd.setSql(sql);
    sqlCmd.setAsColumns(symbols);
    sqlCmd.setAsClauseSet(true);
    // $NON-NLS-1$
    sqlCmd.setIntoGroup(new GroupSymbol("#g"));
    UnitTestUtil.helpTestEquivalence(0, sqlCmd, sqlCmd.clone());
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) DynamicCommand(org.teiid.query.sql.lang.DynamicCommand) Expression(org.teiid.query.sql.symbol.Expression) Constant(org.teiid.query.sql.symbol.Constant) ArrayList(java.util.ArrayList) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) List(java.util.List) SetClauseList(org.teiid.query.sql.lang.SetClauseList) ArrayList(java.util.ArrayList)

Example 69 with ElementSymbol

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

the class TestDynamicCommand method testClone2.

public void testClone2() {
    List symbols = new ArrayList();
    // $NON-NLS-1$
    ElementSymbol a1 = new ElementSymbol("a1");
    a1.setType(DataTypeManager.DefaultDataClasses.STRING);
    symbols.add(a1);
    // $NON-NLS-1$
    Expression sql = new Constant("SELECT * FROM g");
    SetClauseList using = new SetClauseList();
    using.addClause(a1, a1);
    // $NON-NLS-1$
    DynamicCommand sqlCmd = new DynamicCommand(sql, symbols, new GroupSymbol("#g"), using);
    UnitTestUtil.helpTestEquivalence(0, sqlCmd, sqlCmd.clone());
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) DynamicCommand(org.teiid.query.sql.lang.DynamicCommand) Expression(org.teiid.query.sql.symbol.Expression) Constant(org.teiid.query.sql.symbol.Constant) ArrayList(java.util.ArrayList) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) List(java.util.List) SetClauseList(org.teiid.query.sql.lang.SetClauseList) ArrayList(java.util.ArrayList) SetClauseList(org.teiid.query.sql.lang.SetClauseList)

Example 70 with ElementSymbol

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

the class TestMatchCriteria method example.

// ################################## TEST HELPERS ################################
public static MatchCriteria example(String element, String str) {
    MatchCriteria crit = new MatchCriteria();
    crit.setLeftExpression(new ElementSymbol(element));
    crit.setRightExpression(new Constant(str));
    return crit;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Constant(org.teiid.query.sql.symbol.Constant)

Aggregations

ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)417 ArrayList (java.util.ArrayList)165 Test (org.junit.Test)157 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)148 Expression (org.teiid.query.sql.symbol.Expression)104 List (java.util.List)103 Constant (org.teiid.query.sql.symbol.Constant)94 MultipleElementSymbol (org.teiid.query.sql.symbol.MultipleElementSymbol)41 SymbolMap (org.teiid.query.sql.util.SymbolMap)40 PlanNode (org.teiid.query.optimizer.relational.plantree.PlanNode)36 CompareCriteria (org.teiid.query.sql.lang.CompareCriteria)29 Map (java.util.Map)28 AggregateSymbol (org.teiid.query.sql.symbol.AggregateSymbol)28 Query (org.teiid.query.sql.lang.Query)26 HashMap (java.util.HashMap)25 Select (org.teiid.query.sql.lang.Select)24 BufferManager (org.teiid.common.buffer.BufferManager)22 Criteria (org.teiid.query.sql.lang.Criteria)22 LinkedList (java.util.LinkedList)20 TupleBuffer (org.teiid.common.buffer.TupleBuffer)19