use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testMultiReplacementWithOrderBy.
@Test
public void testMultiReplacementWithOrderBy() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT a, b, source_name || a FROM MultiModel.Phys order by a";
// $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"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("f", "z", "bf"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("x", "z", "ax"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("y", "z", "ay") };
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 testMultiDependentJoin.
@Test
public void testMultiDependentJoin() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT a.a FROM MultiModel.Phys a inner join MultiModel.Phys b makedep on (a.a = b.a) order by a";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "x" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "x" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "x" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "x" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "y" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "y" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "y" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "y" }) };
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<?>[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "x" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "y" }) });
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT g_0.a FROM MultiModel.Phys AS g_0 WHERE g_0.a IN ('x', 'y')", new List<?>[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "x" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "y" }) });
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 testSingleReplacement.
@Test
public void testSingleReplacement() throws Exception {
final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT * FROM MultiModel.Phys WHERE SOURCE_NAME = 'a'";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { Arrays.asList(new Object[] { null, null }) };
final HardcodedDataManager dataMgr = new MultiSourceDataManager();
dataMgr.setMustRegisterCommands(false);
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 testAggNotParitionedGroupBy.
@Test
public void testAggNotParitionedGroupBy() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT max(phys.a) FROM MultiModel.Phys group by b";
// $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("y") };
final HardcodedDataManager dataMgr = new HardcodedDataManager();
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT g_0.b, MAX(g_0.a) FROM MultiModel.Phys AS g_0 GROUP BY g_0.b", new List<?>[] { Arrays.asList("x", "y") });
ProcessorPlan plan = helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
TestOptimizer.checkNodeTypes(plan, new int[] { // Access
3, // DependentAccess
0, // DependentSelect
0, // DependentProject
0, // DupRemove
0, // Grouping
1, // NestedLoopJoinStrategy
0, // MergeJoinStrategy
0, // Null
0, // PlanExecution
0, // Project
1, // Select
0, // Sort
0, // UnionAll
1 });
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testMultiReplacementWithProjectConstant.
@Test
public void testMultiReplacementWithProjectConstant() throws Exception {
final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT a, b, source_name || a, '1' FROM MultiModel.Phys";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { Arrays.asList("x", "z", "ax", "1") };
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("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<?>[] {});
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
Aggregations