Examples of TupleBatch


Examples of org.teiid.common.buffer.TupleBatch

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

Examples of org.teiid.common.buffer.TupleBatch

    }
   
    @Test public void testOffsetInFirstBatch() throws Exception {
        LimitNode node = getOffsetNode(49, new FakeRelationalNode(2, getRows(100), 50));
        // batch 1
        TupleBatch batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(1, batch.getRowCount());
        assertEquals(1, batch.getBeginRow());
        assertEquals(1, batch.getEndRow());
        assertEquals(Arrays.asList(new Object[] {new Integer(50)}), batch.getTuple(1));
        assertFalse(batch.getTerminationFlag());
        // batch2
        batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(50, batch.getRowCount());
        assertEquals(2, batch.getBeginRow());
        assertEquals(51, batch.getEndRow());
        assertEquals(Arrays.asList(new Object[] {new Integer(51)}), batch.getTuple(2));
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here

Examples of org.teiid.common.buffer.TupleBatch

    }
   
    @Test public void testOffsetAtBatchSize() throws Exception {
        LimitNode node = getOffsetNode(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());
        assertEquals(Arrays.asList(new Object[] {new Integer(51)}), batch.getTuple(1));
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here

Examples of org.teiid.common.buffer.TupleBatch

    }
   
    @Test public void testOffsetInSecondBatch() throws Exception {
        LimitNode node = getOffsetNode(55, new FakeRelationalNode(2, getRows(100), 50));
        // batch 1
        TupleBatch batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(45, batch.getRowCount());
        assertEquals(1, batch.getBeginRow());
        assertEquals(45, batch.getEndRow());
        assertEquals(Arrays.asList(new Object[] {new Integer(56)}), batch.getTuple(1));
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here

Examples of org.teiid.common.buffer.TupleBatch

    }
   
    @Test public void testOffsetMultipleOfBatchSize() throws Exception {
        LimitNode node = getOffsetNode(100, new FakeRelationalNode(2, getRows(300), 50));

        TupleBatch batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(50, batch.getRowCount());
        assertEquals(1, batch.getBeginRow());
        assertEquals(50, batch.getEndRow());
        assertEquals(Arrays.asList(new Object[] {new Integer(101)}), batch.getTuple(1));
        assertFalse(batch.getTerminationFlag());
    }
View Full Code Here

Examples of org.teiid.common.buffer.TupleBatch

        List elements = new ArrayList();
        elements.add(new ElementSymbol("a")); //$NON-NLS-1$
       
        List batches = new ArrayList();
        batches.add(BlockedException.INSTANCE);
        TupleBatch batch = new TupleBatch(1, new List[0]);
        batch.setTerminationFlag(true);
        batches.add(batch);
       
        FakeProcessorPlan plan = new FakeProcessorPlan(elements, batches);
        helpTestProcessor(plan, 1000, new List[0]);   
    }
View Full Code Here

Examples of org.teiid.common.buffer.TupleBatch

                    rows[i].add(new Integer(batchRow));
                    expectedResults[batchRow-1] = rows[i];
                    batchRow++;
                }
                                               
                TupleBatch batch = new TupleBatch(batchRow-rows.length, rows);
                if(b == numBatches-1) {
                    batch.setTerminationFlag(true);
                }
                batches.add(batch);
            }
        }
       
View Full Code Here

Examples of org.teiid.common.buffer.TupleBatch

    }
   
    @Test public void testOffsetGreaterThanRowCount() throws Exception {
        LimitNode node = getOffsetNode(100, new FakeRelationalNode(2, getRows(10), 50));

        TupleBatch batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(0, batch.getRowCount());
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here

Examples of org.teiid.common.buffer.TupleBatch

    }
   
    @Test public void testOffsetNoRows() throws Exception {
        LimitNode node = getOffsetNode(100, new FakeRelationalNode(2, getRows(0), 50));

        TupleBatch batch = node.nextBatch();
        assertNotNull(batch);
        assertEquals(0, batch.getRowCount());
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here

Examples of org.teiid.common.buffer.TupleBatch

    }
   
    @Test public void testZeroOffset() throws Exception {
        LimitNode node = getOffsetNode(0, 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();
        assertNotNull(batch);
        assertEquals(50, batch.getRowCount());
        assertEquals(51, batch.getBeginRow());
        assertEquals(100, batch.getEndRow());
        assertTrue(batch.getTerminationFlag());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.