use of org.teiid.translator.jdbc.oracle.OracleExecutionFactory in project teiid by teiid.
the class TestDynamicImportedMetaData method testImportFunction.
@Test
public void testImportFunction() throws Exception {
MetadataFactory mf = createMetadataFactory("x", new Properties());
Table dup = mf.addTable("dup");
mf.addColumn("x", DataTypeManager.DefaultDataTypes.STRING, dup);
MetadataStore ms = mf.asMetadataStore();
server.deployVDB("test", ms);
// $NON-NLS-1$
Connection conn = server.createConnection("jdbc:teiid:test");
Properties importProperties = new Properties();
importProperties.setProperty(NativeMetadataRepository.IMPORT_PUSHDOWN_FUNCTIONS, Boolean.TRUE.toString());
mf = createMetadataFactory("test", importProperties);
NativeMetadataRepository nmr = new NativeMetadataRepository();
OracleExecutionFactory oef = new OracleExecutionFactory();
oef.start();
DataSource ds = Mockito.mock(DataSource.class);
Mockito.stub(ds.getConnection()).toReturn(conn);
nmr.loadMetadata(mf, oef, ds);
Map<String, FunctionMethod> functions = mf.asMetadataStore().getSchemas().get("TEST").getFunctions();
assertEquals(18, functions.size());
}
use of org.teiid.translator.jdbc.oracle.OracleExecutionFactory in project teiid by teiid.
the class TestTPCR method testMultiLevelCorrelationWithSubqueryMergeJoin.
public void testMultiLevelCorrelationWithSubqueryMergeJoin() throws Exception {
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
String ddl = ObjectConverterUtil.convertFileToString(UnitTestUtil.getTestDataFile("tpch.ddl"));
TransformationMetadata tm = RealMetadataFactory.fromDDL("x", new RealMetadataFactory.DDLHolder("tpch1", ddl), new RealMetadataFactory.DDLHolder("tpch2", ddl));
OracleExecutionFactory oef = new OracleExecutionFactory();
oef.setDatabaseVersion(Version.getVersion("11.0"));
SourceCapabilities bsc1 = CapabilitiesConverter.convertCapabilities(oef, 1);
SourceCapabilities bsc2 = CapabilitiesConverter.convertCapabilities(oef, 2);
// $NON-NLS-1$
finder.addCapabilities("tpch1", bsc1);
// $NON-NLS-1$
finder.addCapabilities("tpch2", bsc2);
HardcodedDataManager dm = new HardcodedDataManager(tm);
dm.addData("SELECT g_0.\"S_SUPPLIERKEY\" AS c_0, g_0.\"S_NAME\" AS c_1, g_0.\"S_ADDRESS\" AS c_2 FROM \"SOAEDS\".\"SUPPLIER\" AS g_0, \"SOAEDS\".\"NATION\" AS g_1 WHERE g_0.\"S_NATIONKEY\" = g_1.\"N_NATIONKEY\" AND g_1.\"N_NAME\" = 'BRAZIL' ORDER BY c_0", Arrays.asList(1, "x", "y"));
dm.addData("SELECT g_0.\"PS_SUPPLIERKEY\" AS c_0 FROM \"SOAEDS\".\"PARTSUPP\" AS g_0 WHERE g_0.\"PS_PARTKEY\" IN (SELECT g_1.\"P_PARTKEY\" FROM \"SOAEDS\".\"PART\" AS g_1 WHERE g_1.\"P_NAME\" LIKE 'powder%') AND g_0.\"PS_AVAILQTY\" > (SELECT (0.5 * SUM(g_2.\"L_QUANTITY\")) FROM \"SOAEDS\".\"LINEITEM\" AS g_2 WHERE g_2.\"L_PARTKEY\" = g_0.\"PS_PARTKEY\" AND g_2.\"L_SUPPLIERKEY\" = g_0.\"PS_SUPPLIERKEY\" AND g_2.\"L_SHIPDATE\" >= {ts '1994-01-01 00:00:00.0'} AND g_2.\"L_SHIPDATE\" < {ts '1995-01-01 00:00:00.0'}) ORDER BY c_0", Arrays.asList(1));
String sql = "select s_name, s_address from tpch1.soaeds.supplier, tpch1.soaeds.nation where s_supplierkey in ( select ps_supplierkey from tpch2.soaeds.partsupp where ps_partkey in ( select p_partkey from tpch2.soaeds.part where p_name like 'powder%' ) and ps_availqty > ( select 0.5 * sum(l_quantity) from tpch2.soaeds.lineitem where l_partkey = ps_partkey and l_supplierkey = ps_supplierkey and l_shipdate >= '1994-01-01' and l_shipdate < TIMESTAMPADD(SQL_TSI_YEAR,'1', '1994-01-01') ) ) and s_nationkey = n_nationkey and n_name = 'BRAZIL' order by s_name;";
List<?>[] expected = new List<?>[] { Arrays.asList("x", "y") };
doProcess(tm, sql, finder, dm, expected, DEBUG);
}
use of org.teiid.translator.jdbc.oracle.OracleExecutionFactory in project teiid by teiid.
the class TestTPCR method oracleCapabilities.
public static SourceCapabilities oracleCapabilities() {
OracleExecutionFactory oef = new OracleExecutionFactory();
oef.setDatabaseVersion(Version.DEFAULT_VERSION);
return CapabilitiesConverter.convertCapabilities(oef);
}
Aggregations