use of org.teiid.query.processor.ProcessorDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testMultiReplacement.
@Test
public void testMultiReplacement() throws Exception {
final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT * FROM MultiModel.Phys";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 3;
final List<?>[] expected = new List<?>[] { Arrays.asList(new Object[] { null, null }), Arrays.asList(new Object[] { null, null }), Arrays.asList(new Object[] { null, null }) };
final ProcessorDataManager dataMgr = new MultiSourceDataManager();
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
use of org.teiid.query.processor.ProcessorDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testSingleReplacementInDynamicCommand.
@Test
public void testSingleReplacementInDynamicCommand() throws Exception {
final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "exec Virt.sq1('a')";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 3;
final List<?>[] expected = new List<?>[] { Arrays.asList(new Object[] { null, null }) };
final ProcessorDataManager dataMgr = new MultiSourceDataManager();
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
use of org.teiid.query.processor.ProcessorDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testNoReplacement.
@Test
public void testNoReplacement() throws Exception {
final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT * FROM MultiModel.Phys WHERE SOURCE_NAME = 'bogus'";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List[0];
final ProcessorDataManager dataMgr = new MultiSourceDataManager();
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
use of org.teiid.query.processor.ProcessorDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testSingleReplacementInDynamicCommandNullValue.
@Test
public void testSingleReplacementInDynamicCommandNullValue() throws Exception {
final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "exec Virt.sq1(null)";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 3;
final List<?>[] expected = new List[0];
final ProcessorDataManager dataMgr = new MultiSourceDataManager();
helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
}
use of org.teiid.query.processor.ProcessorDataManager in project teiid by teiid.
the class TestProjectIntoNode method helpTestNextBatch.
private void helpTestNextBatch(int tupleBatchSize, Mode mode) throws Exception {
ProjectIntoNode node = new ProjectIntoNode(2);
TupleSource tupleSource = new FakeDataTupleSource(NUM_ROWS);
RelationalNode child = new FakeRelationalNode(1, tupleSource, tupleBatchSize);
node.addChild(child);
// $NON-NLS-1$
node.setIntoGroup(new GroupSymbol("myGroup"));
// $NON-NLS-1$
ElementSymbol elementSymbol_1 = new ElementSymbol("myGroup.myElement1");
// $NON-NLS-1$
ElementSymbol elementSymbol_2 = new ElementSymbol("myGroup.myElement2");
elementSymbol_1.setType(Integer.class);
elementSymbol_2.setType(String.class);
List<ElementSymbol> elements = Arrays.asList(elementSymbol_1, elementSymbol_2);
node.setIntoElements(elements);
child.setElements(elements);
node.setMode(mode);
// $NON-NLS-1$
node.setModelName("myModel");
CommandContext context = new CommandContext();
BufferManager bm = BufferManagerFactory.getTestBufferManager(tupleBatchSize, tupleBatchSize);
ProcessorDataManager dataManager = new FakePDM(tupleBatchSize);
child.initialize(context, bm, dataManager);
node.initialize(context, bm, dataManager);
node.open();
TupleBatch batch = null;
// Do the remaining batches
while (true) {
try {
batch = node.nextBatch();
break;
} catch (BlockedException e) {
// Normal
}
}
assertNotNull(batch);
List[] tuples = batch.getAllTuples();
assertEquals(1, tuples.length);
Object[] columns = tuples[0].toArray();
assertNotNull(columns);
assertEquals(1, columns.length);
// Should have inserted all rows
assertEquals(new Integer(NUM_ROWS), columns[0]);
}
Aggregations