Search in sources :

Example 51 with ElementSymbol

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

the class TestQueryRewriter method testRewriteCase1954b.

@Test
public void testRewriteCase1954b() throws Exception {
    QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
    CompareCriteria expected = new CompareCriteria();
    // $NON-NLS-1$
    ElementSymbol leftElement = new ElementSymbol("pm1.g1.e4");
    Constant constant = new Constant(new Double(3.0), DataTypeManager.DefaultDataClasses.DOUBLE);
    expected.setLeftExpression(leftElement);
    expected.setRightExpression(constant);
    // resolve against metadata
    QueryResolver.resolveCriteria(expected, metadata);
    // $NON-NLS-1$
    helpTestRewriteCriteria("convert(pm1.g1.e4, string) = '3.0'", expected, metadata);
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Constant(org.teiid.query.sql.symbol.Constant) QueryMetadataInterface(org.teiid.query.metadata.QueryMetadataInterface) Test(org.junit.Test)

Example 52 with ElementSymbol

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

the class TestCompoundCriteria method testClone2.

public void testClone2() {
    // $NON-NLS-1$
    ElementSymbol e1 = new ElementSymbol("e1");
    // $NON-NLS-1$
    CompareCriteria ccrit1 = new CompareCriteria(e1, CompareCriteria.EQ, new Constant("abc"));
    CompoundCriteria comp = new CompoundCriteria(CompoundCriteria.AND, ccrit1, null);
    UnitTestUtil.helpTestEquivalence(0, comp, comp.clone());
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Constant(org.teiid.query.sql.symbol.Constant) CompoundCriteria(org.teiid.query.sql.lang.CompoundCriteria) CompareCriteria(org.teiid.query.sql.lang.CompareCriteria)

Example 53 with ElementSymbol

use of org.teiid.query.sql.symbol.ElementSymbol 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 54 with ElementSymbol

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

the class TestSelect method sample1.

// ################################## TEST HELPERS ################################
public static final Select sample1() {
    List symbols = new ArrayList();
    // $NON-NLS-1$
    symbols.add(new ElementSymbol("a"));
    // $NON-NLS-1$
    symbols.add(new ElementSymbol("b"));
    Select select = new Select();
    MultipleElementSymbol all = new MultipleElementSymbol();
    all.setElementSymbols(symbols);
    select.addSymbol(all);
    return select;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) MultipleElementSymbol(org.teiid.query.sql.symbol.MultipleElementSymbol) MultipleElementSymbol(org.teiid.query.sql.symbol.MultipleElementSymbol) ArrayList(java.util.ArrayList) Select(org.teiid.query.sql.lang.Select) List(java.util.List) ArrayList(java.util.ArrayList)

Example 55 with ElementSymbol

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

the class TestSelect method sample2.

public static final Select sample2() {
    Select select = new Select();
    // $NON-NLS-1$
    select.addSymbol(new ElementSymbol("a"));
    // $NON-NLS-1$
    select.addSymbol(new ElementSymbol("b"));
    // $NON-NLS-1$
    select.addSymbol(new ElementSymbol("c"));
    // $NON-NLS-1$ //$NON-NLS-2$
    select.addSymbol(new AliasSymbol("Z", new ElementSymbol("ZZ 9 Plural Z Alpha")));
    return select;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) MultipleElementSymbol(org.teiid.query.sql.symbol.MultipleElementSymbol) AliasSymbol(org.teiid.query.sql.symbol.AliasSymbol) Select(org.teiid.query.sql.lang.Select)

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