use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testPreparedReplacement.
@Test
public void testPreparedReplacement() throws Exception {
final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT * FROM MultiModel.Phys WHERE SOURCE_NAME = ?";
// $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(), Arrays.asList("a"), null);
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testCountStar.
@Test
public void testCountStar() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT count(*) FROM MultiModel.Phys limit 100";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { Arrays.asList(4) };
final HardcodedDataManager dataMgr = new HardcodedDataManager(metadata);
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT COUNT(*) FROM Phys AS g_0", new List<?>[] { Arrays.asList(2) });
BasicSourceCapabilities bsc = TestAggregatePushdown.getAggregateCapabilities();
bsc.setFunctionSupport("ifnull", true);
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB(), null, new Options().implicitMultiSourceJoin(false), bsc);
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testGroupByNotParitioned.
@Test
public void testGroupByNotParitioned() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT phys.a FROM MultiModel.Phys group by phys.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("y") };
final HardcodedDataManager dataMgr = new HardcodedDataManager();
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT g_0.a FROM MultiModel.Phys AS g_0 GROUP BY g_0.a", new List<?>[] { Arrays.asList("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 testSingleReplacementAltName.
@Test
public void testSingleReplacementAltName() throws Exception {
final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT * FROM MultiModel.Phys WHERE foo = '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);
VDBMetaData vdb = RealMetadataFactory.exampleMultiBindingVDB();
vdb.getModel("MultiModel").addProperty(MultiSourceMetadataWrapper.MULTISOURCE_COLUMN_NAME, "foo");
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, vdb);
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testNonPartitionedDistinct.
@Test
public void testNonPartitionedDistinct() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT distinct a FROM MultiModel.Phys";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { Arrays.asList("a") };
final HardcodedDataManager dataMgr = new HardcodedDataManager(metadata);
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT DISTINCT g_0.a FROM Phys AS g_0", new List<?>[] { Arrays.asList("a") });
BasicSourceCapabilities bsc = TestAggregatePushdown.getAggregateCapabilities();
bsc.setCapabilitySupport(Capability.QUERY_SELECT_DISTINCT, true);
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB(), null, new Options().implicitMultiSourceJoin(false), bsc);
}
Aggregations