public long getIncrementalRowCount(boolean low) { if (this.buffer != null) { return this.buffer.getRowCount(); } if (this.collector != null) { return this.collector.getTupleBuffer().getRowCount(); } if (sortUtility == null) { if (this.iterator instanceof BatchIterator) { TupleBuffer tb = ((BatchIterator)this.iterator).getBuffer(); if (tb != null) { return tb.getRowCount(); } //TODO: should estimate the rows } //TODO: should estimate the rows based upon what is being fed into the sort } return low?0:Long.MAX_VALUE; }
public long getIncrementalRowCount(boolean low) { if (this.buffer != null) { return this.buffer.getRowCount(); } if (this.collector != null) { return this.collector.getTupleBuffer().getRowCount(); } if (sortUtility == null) { if (this.iterator instanceof BatchIterator) { TupleBuffer tb = ((BatchIterator)this.iterator).getBuffer(); if (tb != null) { return tb.getRowCount(); } //TODO: should estimate the rows } //TODO: should estimate the rows based upon what is being fed into the sort } return low?0:Long.MAX_VALUE; }
public long getIncrementalRowCount(boolean low) { if (this.buffer != null) { return this.buffer.getRowCount(); } if (this.collector != null) { return this.collector.getTupleBuffer().getRowCount(); } if (sortUtility == null) { if (this.iterator instanceof BatchIterator) { TupleBuffer tb = ((BatchIterator)this.iterator).getBuffer(); if (tb != null) { return tb.getRowCount(); } //TODO: should estimate the rows } //TODO: should estimate the rows based upon what is being fed into the sort } return low?0:Long.MAX_VALUE; }
IndexedTupleSource getIterator() throws TeiidComponentException, TeiidProcessingException { if (this.iterator == null) { if (this.buffer != null) { iterator = buffer.createIndexedTupleSource(); } else { // return a TupleBatch tuplesource iterator BatchIterator bi = new BatchIterator(this.source); if (this.collector != null) { bi.setBuffer(this.collector.getTupleBuffer(), implicitBuffer == ImplicitBuffer.ON_MARK); if (implicitBuffer == ImplicitBuffer.NONE) { bi.getBuffer().setForwardOnly(true); } this.collector = null; } else if (implicitBuffer != ImplicitBuffer.NONE) { bi.setBuffer(createSourceTupleBuffer(), implicitBuffer == ImplicitBuffer.ON_MARK); } this.iterator = bi; } } return this.iterator; }
IndexedTupleSource getIterator() throws TeiidComponentException, TeiidProcessingException { if (this.iterator == null) { if (this.buffer != null) { iterator = buffer.createIndexedTupleSource(); } else { // return a TupleBatch tuplesource iterator BatchIterator bi = new BatchIterator(this.source); if (this.collector != null) { bi.setBuffer(this.collector.getTupleBuffer(), implicitBuffer == ImplicitBuffer.ON_MARK); if (implicitBuffer == ImplicitBuffer.NONE) { bi.getBuffer().setForwardOnly(true); } this.collector = null; } else if (implicitBuffer != ImplicitBuffer.NONE) { bi.setBuffer(createSourceTupleBuffer(), implicitBuffer == ImplicitBuffer.ON_MARK); } this.iterator = bi; } } return this.iterator; }
IndexedTupleSource getIterator() throws TeiidComponentException, TeiidProcessingException { if (this.iterator == null) { if (this.buffer != null) { iterator = buffer.createIndexedTupleSource(); } else { // return a TupleBatch tuplesource iterator BatchIterator bi = new BatchIterator(this.source); if (this.collector != null) { bi.setBuffer(this.collector.getTupleBuffer(), implicitBuffer == ImplicitBuffer.ON_MARK); if (implicitBuffer == ImplicitBuffer.NONE) { bi.getBuffer().setForwardOnly(true); } this.collector = null; } else if (implicitBuffer != ImplicitBuffer.NONE) { bi.setBuffer(createSourceTupleBuffer(), implicitBuffer == ImplicitBuffer.ON_MARK); } this.iterator = bi; } } return this.iterator; }
tb.addTuple(Arrays.asList(2)); tb.addTuple(Arrays.asList(2)); assertEquals(3, bi.getBuffer().getManagedRowCount()); bi.nextTuple(); assertEquals(0, bi.getBuffer().getManagedRowCount()); for (int i = 0; i < 2; i++) { assertNotNull(bi.nextTuple()); assertEquals(0, bi.getBuffer().getManagedRowCount()); assertEquals(2, bi.getBuffer().getManagedRowCount()); for (int i = 0; i < 4; i++) { assertNotNull(bi.nextTuple()); assertEquals(0, bi.getBuffer().getManagedRowCount()); assertEquals(0, bi.getBuffer().getManagedRowCount());
@Test public void testReadAhead() throws Exception { BatchIterator bi = new BatchIterator(new FakeRelationalNode(1, new List[] { Arrays.asList(1), Arrays.asList(1), Arrays.asList(1), Arrays.asList(1), Arrays.asList(1), Arrays.asList(1), }, 2)); BufferManager bm = BufferManagerFactory.getStandaloneBufferManager(); TupleBuffer tb = bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x", null, DataTypeManager.DefaultDataClasses.INTEGER)), "test", TupleSourceType.PROCESSOR); bi.setBuffer(tb, false); //$NON-NLS-1$ bi.nextTuple(); assertEquals(1, bi.available()); assertEquals(2, bi.getBuffer().getRowCount()); bi.readAhead(100); assertEquals(4, bi.getBuffer().getRowCount()); //shouldn't keep reading bi.readAhead(3); assertEquals(4, bi.getBuffer().getRowCount()); bi.readAhead(5); assertEquals(6, bi.getBuffer().getRowCount()); bi.readAhead(8); //does nothing for (int i = 0; i < 5; i++) { assertNotNull(bi.nextTuple()); } assertNull(bi.nextTuple()); }
bi.nextTuple(); assertEquals(1, bi.available()); assertEquals(0, bi.getBuffer().getRowCount()); bi.readAhead(100); assertEquals(4, bi.getBuffer().getRowCount()); assertEquals(4, bi.getBuffer().getRowCount()); assertEquals(6, bi.getBuffer().getRowCount()); bi.readAhead(8); //does nothing for (int i = 0; i < 6; i++) {