Search in sources :

Example 6 with DDLHolder

use of org.teiid.query.unittest.RealMetadataFactory.DDLHolder in project teiid by teiid.

the class TestFunctionResolving method testImportedPushdown.

@Test
public void testImportedPushdown() throws Exception {
    RealMetadataFactory.example1Cached();
    QueryMetadataInterface tm = RealMetadataFactory.fromDDL("x", new DDLHolder("y", "create foreign function func(x object) returns object;"), new DDLHolder("z", "create foreign function func(x object) returns object;"));
    String sql = "func('a')";
    Function func = (Function) QueryParser.getQueryParser().parseExpression(sql);
    try {
        ResolverVisitor.resolveLanguageObject(func, tm);
        fail("should be ambiguous");
    } catch (QueryResolverException e) {
    }
    tm = RealMetadataFactory.fromDDL("x", new DDLHolder("y", "create foreign function func(x object) returns object options (\"teiid_rel:system-name\" 'f');"), new DDLHolder("z", "create foreign function func(x object) returns object options (\"teiid_rel:system-name\" 'f');"));
    func = (Function) QueryParser.getQueryParser().parseExpression(sql);
    ResolverVisitor.resolveLanguageObject(func, tm);
    tm = RealMetadataFactory.fromDDL("x", new DDLHolder("y", "create foreign function func() returns object options (\"teiid_rel:system-name\" 'f');"), new DDLHolder("z", "create foreign function func() returns object options (\"teiid_rel:system-name\" 'f');"));
    func = (Function) QueryParser.getQueryParser().parseExpression("func()");
    ResolverVisitor.resolveLanguageObject(func, tm);
}
Also used : Function(org.teiid.query.sql.symbol.Function) DDLHolder(org.teiid.query.unittest.RealMetadataFactory.DDLHolder) QueryMetadataInterface(org.teiid.query.metadata.QueryMetadataInterface) QueryResolverException(org.teiid.api.exception.query.QueryResolverException) Test(org.junit.Test)

Aggregations

DDLHolder (org.teiid.query.unittest.RealMetadataFactory.DDLHolder)6 Test (org.junit.Test)5 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)5 BasicSourceCapabilities (org.teiid.query.optimizer.capabilities.BasicSourceCapabilities)3 DefaultCapabilitiesFinder (org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder)3 CommandContext (org.teiid.query.util.CommandContext)3 QueryResolverException (org.teiid.api.exception.query.QueryResolverException)2 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)2 HardcodedDataManager (org.teiid.query.processor.HardcodedDataManager)2 ProcessorPlan (org.teiid.query.processor.ProcessorPlan)2 Function (org.teiid.query.sql.symbol.Function)2 Hashtable (java.util.Hashtable)1 ServletOutputStream (javax.servlet.ServletOutputStream)1 WriteListener (javax.servlet.WriteListener)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 CsdlSchema (org.apache.olingo.commons.api.edm.provider.CsdlSchema)1 OData (org.apache.olingo.server.api.OData)1 ODataHttpHandler (org.apache.olingo.server.api.ODataHttpHandler)1 ServiceMetadata (org.apache.olingo.server.api.ServiceMetadata)1