Search in sources :

Example 6 with Select

use of org.teiid.query.sql.lang.Select 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 7 with Select

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

the class TestSelect method testSelfEquivalence.

public void testSelfEquivalence() {
    Select s1 = sample1();
    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, s1, s1);
}
Also used : Select(org.teiid.query.sql.lang.Select)

Example 8 with Select

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

the class TestSelect method testEquivalence.

public void testEquivalence() {
    Select s1 = sample1();
    Select s1a = sample1();
    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, s1, s1a);
}
Also used : Select(org.teiid.query.sql.lang.Select)

Example 9 with Select

use of org.teiid.query.sql.lang.Select 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)

Example 10 with Select

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

the class TestSelect method testGetProjectedWithStar.

public void testGetProjectedWithStar() {
    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);
    List projectedSymbols = select.getProjectedSymbols();
    // $NON-NLS-1$
    assertEquals("Did not get correct list for select *: ", symbols, projectedSymbols);
}
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)

Aggregations

Select (org.teiid.query.sql.lang.Select)50 Query (org.teiid.query.sql.lang.Query)30 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)26 MultipleElementSymbol (org.teiid.query.sql.symbol.MultipleElementSymbol)26 From (org.teiid.query.sql.lang.From)25 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)24 Test (org.junit.Test)17 SetQuery (org.teiid.query.sql.lang.SetQuery)17 Constant (org.teiid.query.sql.symbol.Constant)15 UnaryFromClause (org.teiid.query.sql.lang.UnaryFromClause)11 Limit (org.teiid.query.sql.lang.Limit)10 ArrayList (java.util.ArrayList)5 CompareCriteria (org.teiid.query.sql.lang.CompareCriteria)5 Reference (org.teiid.query.sql.symbol.Reference)5 Element (org.jdom.Element)4 Expression (org.teiid.query.sql.symbol.Expression)4 List (java.util.List)3 Attribute (org.jdom.Attribute)3 PlanNode (org.teiid.query.optimizer.relational.plantree.PlanNode)3 LanguageObject (org.teiid.query.sql.LanguageObject)3