/** * Pro-actively pull batches for later use. * There are unfortunately quite a few cases to cover here. */ protected void prefetch(long limit) throws TeiidComponentException, TeiidProcessingException { if (!open) { return; } if (this.buffer == null) { if (this.sortUtility != null) { return; } if (this.iterator != null) { ((BatchIterator)this.iterator).readAhead(limit); return; } if (source.hasBuffer()) { this.buffer = source.getBuffer(-1); return; } if (collector == null) { collector = new BatchCollector(source, source.getBufferManager(), source.getContext(), false); } if (collector.getTupleBuffer() != null && collector.getTupleBuffer().getManagedRowCount() >= limit) { return; } this.buffer = collector.collectTuples(true); } }
/** * Flush the batch by giving it to the buffer manager. */ private void flushBatch(TupleBatch batch) throws TeiidComponentException, TeiidProcessingException { if (batch.getRowCount() == 0 && batch.getTermination() == TupleBatch.NOT_TERMINATED) { return; } flushBatchDirect(batch, true); }
public TupleBuffer getTupleBuffer() throws TeiidComponentException, TeiidProcessingException { if (this.buffer == null) { if (this.iterator instanceof BatchIterator) { throw new AssertionError("cannot buffer the source"); //$NON-NLS-1$ } if (source.hasBuffer()) { this.buffer = source.getBuffer(-1); Assertion.assertTrue(this.buffer.isFinal()); return this.buffer; } if (collector == null) { collector = new BatchCollector(source, source.getBufferManager(), source.getContext(), false); } this.buffer = collector.collectTuples(); } return this.buffer; }
public TupleBuffer collectTuples() throws TeiidComponentException, TeiidProcessingException { return collectTuples(false); }
if (!request.addedLimit && this.requestMsg.getRowLimit() > 0 && this.requestMsg.getRowLimit() < Integer.MAX_VALUE) { this.collector.setRowLimit(this.requestMsg.getRowLimit()); this.collector.setSaveLastRow(request.isReturingParams()); this.resultsBuffer = collector.getTupleBuffer(); if (this.resultsBuffer == null) {
@Override public void closeSource() { super.closeSource(); qp.closeProcessing(); if (!success && bc.getTupleBuffer() != null) { bc.getTupleBuffer().remove(); } } };
if (sortOption == SortOption.NOT_SORTED) { this.buffer = this.collector.getTupleBuffer(); ts = new BatchCollector.BatchProducerTupleSource(this.source, this.buffer.getRowCount() + 1); } else { this.buffer = this.collector.collectTuples();
public BatchCollector createBatchCollector() throws TeiidComponentException { return new BatchCollector(this, this.bufferMgr, this.context, false); }
cr.setCommand(originalCommand); cr.setResults(resultsBuffer, processor.getProcessorPlan()); if (requestMsg.getRowLimit() > 0 && resultsBuffer.getRowCount() == requestMsg.getRowLimit() + (collector.isSaveLastRow()?1:0)) { cr.setRowLimit(requestMsg.getRowLimit());
public TupleBuffer collectTuples() throws TeiidComponentException, TeiidProcessingException { return collectTuples(false); }
if (!request.addedLimit && this.requestMsg.getRowLimit() > 0 && this.requestMsg.getRowLimit() < Integer.MAX_VALUE) { this.collector.setRowLimit(this.requestMsg.getRowLimit()); this.collector.setSaveLastRow(request.isReturingParams()); this.resultsBuffer = collector.getTupleBuffer(); if (this.resultsBuffer == null) {
@Override public void closeSource() { super.closeSource(); qp.closeProcessing(); if (!success && bc.getTupleBuffer() != null) { bc.getTupleBuffer().remove(); } } };
public TupleBuffer getTupleBuffer() throws TeiidComponentException, TeiidProcessingException { if (this.buffer == null) { if (this.iterator instanceof BatchIterator) { throw new AssertionError("cannot buffer the source"); //$NON-NLS-1$ } if (source.hasBuffer()) { this.buffer = source.getBuffer(-1); Assertion.assertTrue(this.buffer.isFinal()); return this.buffer; } if (collector == null) { collector = new BatchCollector(source, source.getBufferManager(), source.getContext(), false); } this.buffer = collector.collectTuples(); } return this.buffer; }
if (sortOption == SortOption.NOT_SORTED) { this.buffer = this.collector.getTupleBuffer(); ts = new BatchCollector.BatchProducerTupleSource(this.source, this.buffer.getRowCount() + 1); } else { this.buffer = this.collector.collectTuples();
public BatchCollector createBatchCollector() throws TeiidComponentException { return new BatchCollector(this, this.bufferMgr, this.context, false); }
cr.setCommand(originalCommand); cr.setResults(resultsBuffer, processor.getProcessorPlan()); if (requestMsg.getRowLimit() > 0 && resultsBuffer.getRowCount() == requestMsg.getRowLimit() + (collector.isSaveLastRow()?1:0)) { cr.setRowLimit(requestMsg.getRowLimit());
flushBatch(batch);
/** * Pro-actively pull batches for later use. * There are unfortunately quite a few cases to cover here. */ protected void prefetch(long limit) throws TeiidComponentException, TeiidProcessingException { if (!open) { return; } if (this.buffer == null) { if (this.sortUtility != null) { return; } if (this.iterator != null) { ((BatchIterator)this.iterator).readAhead(limit); return; } if (source.hasBuffer()) { this.buffer = source.getBuffer(-1); return; } if (collector == null) { collector = new BatchCollector(source, source.getBufferManager(), source.getContext(), false); } if (collector.getTupleBuffer() != null && collector.getTupleBuffer().getManagedRowCount() >= limit) { return; } this.buffer = collector.collectTuples(true); } }
public TupleBuffer collectTuples() throws TeiidComponentException, TeiidProcessingException { return collectTuples(false); }