use of org.teiid.api.exception.query.QueryResolverException 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);
}
use of org.teiid.api.exception.query.QueryResolverException in project teiid by teiid.
the class TestFunctionResolving method testResolveBadConvert.
@Test
public void testResolveBadConvert() throws Exception {
// $NON-NLS-1$
Function function = new Function("convert", new Expression[] { new Constant(new Character('a')), new Constant(DataTypeManager.DefaultDataTypes.DATE) });
try {
ResolverVisitor.resolveLanguageObject(function, RealMetadataFactory.example1Cached());
// $NON-NLS-1$
fail("excpetion expected");
} catch (QueryResolverException err) {
// $NON-NLS-1$
assertEquals("TEIID30071 The conversion from char to date is not allowed.", err.getMessage());
}
}
Aggregations