Search in sources :

Example 6 with BatchIterator

use of org.teiid.query.processor.BatchIterator in project teiid by teiid.

the class TestSelectNode method helpTestSelect.

private void helpTestSelect(List elements, Criteria criteria, List childElements, ProcessorDataManager dataMgr, List[] expected, RelationalNode child, SelectNode selectNode) throws TeiidComponentException, TeiidProcessingException {
    BufferManager mgr = BufferManagerFactory.getStandaloneBufferManager();
    // $NON-NLS-1$ //$NON-NLS-2$
    CommandContext context = new CommandContext("pid", "test", null, null, 1);
    child.setElements(childElements);
    child.initialize(context, mgr, dataMgr);
    selectNode.setCriteria(criteria);
    selectNode.setElements(elements);
    selectNode.addChild(child);
    selectNode.initialize(context, mgr, dataMgr);
    selectNode.open();
    BatchIterator iterator = new BatchIterator(selectNode);
    for (int i = 0; i < expected.length; i++) {
        while (true) {
            try {
                // $NON-NLS-1$
                assertEquals("Rows don't match at " + i, expected[i], iterator.nextTuple());
                break;
            } catch (BlockedException e) {
                continue;
            }
        }
    }
    assertFalse(iterator.hasNext());
}
Also used : CommandContext(org.teiid.query.util.CommandContext) BatchIterator(org.teiid.query.processor.BatchIterator) BufferManager(org.teiid.common.buffer.BufferManager) BlockedException(org.teiid.common.buffer.BlockedException)

Aggregations

BatchIterator (org.teiid.query.processor.BatchIterator)6 TupleBuffer (org.teiid.common.buffer.TupleBuffer)2 TupleSource (org.teiid.common.buffer.TupleSource)2 CommandContext (org.teiid.query.util.CommandContext)2 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Map (java.util.Map)1 BlockedException (org.teiid.common.buffer.BlockedException)1 BufferManager (org.teiid.common.buffer.BufferManager)1 IndexedTupleSource (org.teiid.common.buffer.IndexedTupleSource)1 BatchCollector (org.teiid.query.processor.BatchCollector)1 QueryProcessor (org.teiid.query.processor.QueryProcessor)1 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)1