Package org.teiid.common.buffer

Examples of org.teiid.common.buffer.TupleBatch


        node.open();
       
        int currentRow = 1;
        while(true) {
            try {
                TupleBatch batch = node.nextBatch();
                for(int row = currentRow; row <= batch.getEndRow(); row++) {
                    List tuple = batch.getTuple(row);
                    assertEquals("Rows don't match at " + row, expected[row-1], tuple); //$NON-NLS-1$
                }
                currentRow += batch.getRowCount();
                if(batch.getTerminationFlag()) {
                    break;
                }
            } catch (BlockedException e) {
                //ignore
            }
View Full Code Here


       
        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
View Full Code Here

   
    public void testNoRowsFirstBatch() throws Exception {
        RelationalNode node = new FakeRelationalNode(0, new List[0]);
       
        RelationalPlan plan = new RelationalPlan(node);
        TupleBatch batch = plan.nextBatch();
        assertTrue("Did not get terminator batch", batch.getTerminationFlag()); //$NON-NLS-1$
    }  
View Full Code Here

        join.open();
       
        int currentRow = 1;
        while(true) {
            try {
                TupleBatch batch = join.nextBatch();
                for(;currentRow <= batch.getEndRow(); currentRow++) {
                    List tuple = batch.getTuple(currentRow);
                    assertEquals("Rows don't match at " + currentRow, expectedResults[currentRow-1], tuple); //$NON-NLS-1$
                }
                if(batch.getTerminationFlag()) {
                    break;
                }
            } catch(BlockedException e) {
                // ignore and retry
            }
View Full Code Here

public class TestLimitNode {
   
    @Test public void testLimitInFirstBatch() throws Exception {
        LimitNode node = getLimitNode(40, new FakeRelationalNode(2, getRows(100), 50));
       
        TupleBatch batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(40, batch.getRowCount());
        assertEquals(1, batch.getBeginRow());
        assertEquals(40, batch.getEndRow());
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here

    }

    @Test public void testLimitAtBatchSize() throws Exception {
        LimitNode node = getLimitNode(50, new FakeRelationalNode(2, getRows(100), 50));
       
        TupleBatch batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(50, batch.getRowCount());
        assertEquals(1, batch.getBeginRow());
        assertEquals(50, batch.getEndRow());
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here

    }

    @Test public void testLimitInSecondBatch() throws Exception {
        LimitNode node = getLimitNode(55, new FakeRelationalNode(2, getRows(100), 50));
       
        TupleBatch batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(50, batch.getRowCount());
        assertEquals(1, batch.getBeginRow());
        assertEquals(50, batch.getEndRow());
        assertFalse(batch.getTerminationFlag());
       
        batch = node.nextBatch();
        assertEquals(5, batch.getRowCount());
        assertEquals(51, batch.getBeginRow());
        assertEquals(55, batch.getEndRow());
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here

    }

    @Test public void testLimitMultipleOfBatchSize() throws Exception {
        LimitNode node = getLimitNode(100, new FakeRelationalNode(2, getRows(150), 50));
       
        TupleBatch batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(50, batch.getRowCount());
        assertEquals(1, batch.getBeginRow());
        assertEquals(50, batch.getEndRow());
        assertFalse(batch.getTerminationFlag());
       
        batch = node.nextBatch();
        assertEquals(50, batch.getRowCount());
        assertEquals(51, batch.getBeginRow());
        assertEquals(100, batch.getEndRow());
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here

    }

    @Test public void testLimitProducesMultipleBatches() throws Exception {
        LimitNode node = getLimitNode(130, new FakeRelationalNode(2, getRows(300), 50));
       
        TupleBatch batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(50, batch.getRowCount());
        assertEquals(1, batch.getBeginRow());
        assertEquals(50, batch.getEndRow());
        assertFalse(batch.getTerminationFlag());
       
        batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(50, batch.getRowCount());
        assertEquals(51, batch.getBeginRow());
        assertEquals(100, batch.getEndRow());
        assertFalse(batch.getTerminationFlag());

        batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(30, batch.getRowCount());
        assertEquals(101, batch.getBeginRow());
        assertEquals(130, batch.getEndRow());
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here

    }

    @Test public void testLimitGetsNoRows() throws Exception {
        LimitNode node = getLimitNode(100, new FakeRelationalNode(2, getRows(0), 50));
       
        TupleBatch batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(0, batch.getRowCount());
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here

TOP

Related Classes of org.teiid.common.buffer.TupleBatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.