use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testVirtualProcedureNoDataInTempTable.
@Test
public void testVirtualProcedureNoDataInTempTable() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp25()";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Create expected results
List[] expected = new List[] {};
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testRemovalOfNonJoinCritWithReference.
/**
* Test the use of a procedure variable in the criteria of a LEFT OUTER
* JOIN which will be optimized out as non-JOIN criteria.
* <p>
* This test case verifies that the procedure variable will not be pushed
* to the data manager when a federated source JOIN is performed.
*
* @throws Exception
*/
@Test
public void testRemovalOfNonJoinCritWithReference() throws Exception {
// $NON-NLS-1$
String proc = "";
// $NON-NLS-1$
String sql = "";
sql += // $NON-NLS-1$
"SELECT " + // $NON-NLS-1$
" pm1.g1.e1 AS pm1g1e1, " + // $NON-NLS-1$
" pm2.g2.e1 AS pm2g2e1, " + // $NON-NLS-1$
" pm1.g1.e2 AS pm1g1e2, " + // $NON-NLS-1$
" pm2.g2.e2 AS pm2g2e2 " + // $NON-NLS-1$
"FROM " + // $NON-NLS-1$
" pm1.g1 " + // $NON-NLS-1$
"LEFT OUTER JOIN pm2.g2 " + // $NON-NLS-1$
" ON pm1.g1.e1 = pm2.g2.e1 " + // $NON-NLS-1$
" AND pm2.g2.e2 = VARIABLES.myVar ";
proc += // $NON-NLS-1$
"CREATE VIRTUAL PROCEDURE " + // $NON-NLS-1$
"BEGIN " + // $NON-NLS-1$
" declare integer myVar = 5;" + " " + sql + // $NON-NLS-1$ //$NON-NLS-2$
";" + // $NON-NLS-1$
"END";
TransformationMetadata metadata = RealMetadataFactory.example1();
addProc(metadata, "sq1", proc, new String[] { "e1", "e2", "e3", "e4" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER }, new String[0], new String[0]);
// $NON-NLS-1$
String userQuery = "SELECT * FROM (EXEC pm1.sq1()) as proc";
FakeDataManager dataMgr = exampleDataManager2(metadata);
ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
List[] expected = new List[] { // $NON-NLS-1$ //$NON-NLS-2$
Arrays.asList(new Object[] { "First", "First", Integer.valueOf(5), Integer.valueOf(5) }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Second", null, Integer.valueOf(15), null }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Third", null, Integer.valueOf(51), null }) };
helpTestProcess(plan, expected, dataMgr, metadata);
assertTrue(!plan.requiresTransaction(false));
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testVirtualProcedure15.
@Test
public void testVirtualProcedure15() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp19()";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Create expected results
List[] expected = new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "First" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Second" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Third" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "First" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Second" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Third" }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testVirtualProcedure30.
@Test
public void testVirtualProcedure30() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp30()";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
// Create expected results
List[] expected = new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "First" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Second" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Third" }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
use of org.teiid.query.processor.FakeDataManager in project teiid by teiid.
the class TestProcedureProcessor method testDefect17451.
@Test
public void testDefect17451() throws Exception {
// $NON-NLS-1$
String userUpdateStr = "EXEC pm1.vsp45()";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// Set up data
FakeDataManager dataMgr = exampleDataManager(metadata);
ProcessorPlan plan = getProcedurePlan(userUpdateStr, metadata);
dataMgr.registerTuples(metadata, "pm1.g2", new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "First", Integer.valueOf(5), new Boolean(true), new Double(1.003) }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Third", Integer.valueOf(51), new Boolean(true), new Double(3.003) }) });
// Create expected results
List[] expected = new List[] { // $NON-NLS-1$
Arrays.asList(new Object[] { "First" }), // $NON-NLS-1$
Arrays.asList(new Object[] { "Third" }) };
helpTestProcess(plan, expected, dataMgr, metadata);
}
Aggregations