Search in sources :

Example 6 with Function

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

the class TestStaticSymbolMappingVisitor method testFunction1.

public void testFunction1() {
    // $NON-NLS-1$
    Function f = new Function("concat", new Expression[] {});
    helpTest(f, getSymbolMap());
}
Also used : Function(org.teiid.query.sql.symbol.Function)

Example 7 with Function

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

the class TestStaticSymbolMappingVisitor method testVisitSelect4.

public void testVisitSelect4() {
    Select select = new Select();
    select.addSymbol(new ExpressionSymbol("x", // $NON-NLS-1$ //$NON-NLS-2$
    new Function("length", new Expression[] { exampleElement(true, 0) })));
    // $NON-NLS-1$
    select.addSymbol(new MultipleElementSymbol("abc.*"));
    select.addSymbol(exampleElement(true, 1));
    helpTest(select, getSymbolMap());
}
Also used : Function(org.teiid.query.sql.symbol.Function) MultipleElementSymbol(org.teiid.query.sql.symbol.MultipleElementSymbol) Select(org.teiid.query.sql.lang.Select) ExpressionSymbol(org.teiid.query.sql.symbol.ExpressionSymbol)

Example 8 with Function

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

the class TestStaticSymbolMappingVisitor method testFunction2.

public void testFunction2() {
    // $NON-NLS-1$
    Function f = new Function("concat", new Expression[] { exampleElement(true, 0), exampleElement(true, 1) });
    helpTest(f, getSymbolMap());
}
Also used : Function(org.teiid.query.sql.symbol.Function)

Example 9 with Function

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

the class TestFunction method testFunction1.

// ################################## TEST HELPERS ################################
// ################################## ACTUAL TESTS ################################
public void testFunction1() {
    // $NON-NLS-1$ //$NON-NLS-2$
    Function f1 = new Function("f1", new Expression[] { new Constant("xyz") });
    // $NON-NLS-1$ //$NON-NLS-2$
    Function f2 = new Function("f1", new Expression[] { new Constant("xyz") });
    UnitTestUtil.helpTestEquivalence(0, f1, f2);
}
Also used : Function(org.teiid.query.sql.symbol.Function) Constant(org.teiid.query.sql.symbol.Constant)

Example 10 with Function

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

the class TestFunction method testFunction6.

public void testFunction6() {
    // $NON-NLS-1$ //$NON-NLS-2$
    Function f1 = new Function("f1", new Expression[] { new Constant("xyz") });
    // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    Function f2 = new Function("f1", new Expression[] { new Constant("xyz"), new Constant("xyz") });
    UnitTestUtil.helpTestEquivalence(1, f1, f2);
}
Also used : Function(org.teiid.query.sql.symbol.Function) Constant(org.teiid.query.sql.symbol.Constant)

Aggregations

Function (org.teiid.query.sql.symbol.Function)55 Constant (org.teiid.query.sql.symbol.Constant)31 Test (org.junit.Test)25 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)16 Expression (org.teiid.query.sql.symbol.Expression)12 FunctionDescriptor (org.teiid.query.function.FunctionDescriptor)11 ArrayList (java.util.ArrayList)10 List (java.util.List)7 ScalarSubquery (org.teiid.query.sql.symbol.ScalarSubquery)7 SearchedCaseExpression (org.teiid.query.sql.symbol.SearchedCaseExpression)6 HashMap (java.util.HashMap)5 ExpressionSymbol (org.teiid.query.sql.symbol.ExpressionSymbol)5 Map (java.util.Map)4 QueryResolverException (org.teiid.api.exception.query.QueryResolverException)4 TeiidRuntimeException (org.teiid.core.TeiidRuntimeException)4 Reference (org.teiid.query.sql.symbol.Reference)4 FunctionLibrary (org.teiid.query.function.FunctionLibrary)3 BasicSourceCapabilities (org.teiid.query.optimizer.capabilities.BasicSourceCapabilities)3 FakeDataManager (org.teiid.query.processor.FakeDataManager)3 Query (org.teiid.query.sql.lang.Query)3