use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testMultiJoinImplicit.
@Test
public void testMultiJoinImplicit() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT phys.a FROM MultiModel.Phys, MultiModel.phys1 where phys.a = phys1.b";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { Arrays.asList("a"), Arrays.asList("a") };
final HardcodedDataManager dataMgr = new HardcodedDataManager();
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT g_0.a FROM MultiModel.Phys AS g_0, MultiModel.Phys1 AS g_1 WHERE g_0.a = g_1.b", new List<?>[] { Arrays.asList("a") });
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testNested.
@Test
public void testNested() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "select max(source_name), a from (SELECT a, source_name FROM MultiModel.Phys union all select b, source_name from MultiModel.phys1) as x group by a";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { Arrays.asList("b", 1) };
final HardcodedDataManager dataMgr = new HardcodedDataManager();
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT v_0.c_0, MAX(v_0.c_1) FROM (SELECT g_1.a AS c_0, 'a' AS c_1 FROM MultiModel.Phys AS g_1 UNION ALL SELECT g_0.b AS c_0, 'a' AS c_1 FROM MultiModel.Phys1 AS g_0) AS v_0 GROUP BY v_0.c_0", new List<?>[] { Arrays.asList(1, "a") });
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT v_0.c_0, MAX(v_0.c_1) FROM (SELECT g_1.a AS c_0, 'b' AS c_1 FROM MultiModel.Phys AS g_1 UNION ALL SELECT g_0.b AS c_0, 'b' AS c_1 FROM MultiModel.Phys1 AS g_0) AS v_0 GROUP BY v_0.c_0", new List<?>[] { Arrays.asList(1, "b") });
BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
bsc.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
bsc.setCapabilitySupport(Capability.ROW_LIMIT, true);
bsc.setCapabilitySupport(Capability.QUERY_GROUP_BY, true);
bsc.setCapabilitySupport(Capability.QUERY_UNION, true);
bsc.setCapabilitySupport(Capability.QUERY_FROM_INLINE_VIEWS, true);
bsc.setFunctionSupport(SourceSystemFunctions.CONCAT, true);
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB(), null, null, bsc);
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testMultiJoinPartitionedExplicit.
@Test
public void testMultiJoinPartitionedExplicit() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT phys.a FROM MultiModel.Phys, MultiModel.phys1 where phys.a = phys1.b and Phys.source_name = phys1.source_name";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { Arrays.asList("a"), Arrays.asList("a") };
final HardcodedDataManager dataMgr = new HardcodedDataManager();
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT g_0.a FROM MultiModel.Phys AS g_0, MultiModel.Phys1 AS g_1 WHERE g_0.a = g_1.b", new List<?>[] { Arrays.asList("a") });
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB(), null, new Options().implicitMultiSourceJoin(false));
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testMultiReplacementWithLimit.
@Test
public void testMultiReplacementWithLimit() throws Exception {
final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT distinct a, b, source_name || a FROM MultiModel.Phys order by a limit 1";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("e", "z", "be") };
final HardcodedDataManager dataMgr = new HardcodedDataManager();
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT g_0.a, g_0.b, concat('a', g_0.a) FROM MultiModel.Phys AS g_0", new List<?>[] { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("y", "z", "ay"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("x", "z", "ax") });
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT g_0.a, g_0.b, concat('b', g_0.a) FROM MultiModel.Phys AS g_0", new List<?>[] { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("e", "z", "be"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("f", "z", "bf") });
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testMultiJoinNotImplicit.
/**
* With implicit join turned off, we now get the join of the union of the source queries.
*/
@Test
public void testMultiJoinNotImplicit() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT phys.a FROM MultiModel.Phys, MultiModel.phys1 where phys.a = phys1.b";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { Arrays.asList("a"), Arrays.asList("a"), Arrays.asList("a"), Arrays.asList("a") };
final HardcodedDataManager dataMgr = new HardcodedDataManager();
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT g_0.a FROM MultiModel.Phys AS g_0", new List<?>[] { Arrays.asList("a") });
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT g_0.b FROM MultiModel.Phys1 AS g_0", new List<?>[] { Arrays.asList("a") });
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB(), null, new Options().implicitMultiSourceJoin(false));
}
Aggregations