@Override public void cleanup() throws Exception { if (this.sorter != null) { this.sorter.dispose(); } this.taskContext.getMemoryManager().release(this.memory); }
if (!currentBuffer.buffer.isEmpty()) { throw new IOException("New buffer is not empty."); if (!buffer.write(current)) { if (buffer.isEmpty()) { } else { throw new IOException("The record exceeds the maximum size of a sort buffer (current maximum: " + buffer.getCapacity() + " bytes)."); buffer.reset(); break; } else { bytesUntilSpilling -= buffer.getCapacity(); if (bytesUntilSpilling - buffer.getOccupancy() <= 0) { bytesUntilSpilling = 0;
@Override public E next() { if (this.position <= this.last) { try { E record; if (objectReuseEnabled) { record = this.buffer.getRecord(this.recordReuse, this.position); } else { record = this.buffer.getRecord(this.position); } this.position++; return record; } catch (IOException ioex) { LOG.error("Error retrieving a value from a buffer.", ioex); throw new RuntimeException("Could not load the next value: " + ioex.getMessage(), ioex); } } else { throw new NoSuchElementException(); } }
private void collectSorted(T record) throws Exception { // try writing to the sorter first if (!sorter.write(record)) { // it didn't succeed; sorter is full // do the actual sorting, combining, and data writing sortAndCombine(); sorter.reset(); // write the value again if (!sorter.write(record)) { throw new IOException("Cannot write record to fresh sort buffer. Record too large."); } } }
if (!sorter.isEmpty()) { this.sortAlgo.sort(sorter); final ReusingKeyGroupedIterator<IN> keyIter = new ReusingKeyGroupedIterator<IN>(sorter.getIterator(), this.serializer, this.groupingComparator); if (!sorter.isEmpty()) { this.sortAlgo.sort(sorter); final NonReusingKeyGroupedIterator<IN> keyIter = new NonReusingKeyGroupedIterator<IN>(sorter.getIterator(), this.groupingComparator);
private void collectSorted(T record) throws Exception { // try writing to the sorter first if (!sorter.write(record)) { // it didn't succeed; sorter is full // do the actual sorting, combining, and data writing sortAndCombine(); sorter.reset(); // write the value again if (!sorter.write(record)) { throw new IOException("Cannot write record to fresh sort buffer. Record too large."); } } }
if (!sorter.isEmpty()) { this.sortAlgo.sort(sorter); final ReusingKeyGroupedIterator<IN> keyIter = new ReusingKeyGroupedIterator<IN>(sorter.getIterator(), this.serializer, this.groupingComparator); if (!sorter.isEmpty()) { this.sortAlgo.sort(sorter); final NonReusingKeyGroupedIterator<IN> keyIter = new NonReusingKeyGroupedIterator<IN>(sorter.getIterator(), this.groupingComparator);
if (!buffer.isEmpty()) { throw new IOException("New buffer is not empty."); if (!buffer.write(leftoverRecord)) { + buffer.getCapacity() + " bytes)."); buffer.reset(); if (bytesUntilSpilling > 0 && buffer.getCapacity() >= bytesUntilSpilling) if (!buffer.write(current)) { leftoverRecord = current; fullBuffer = true; if (bytesUntilSpilling - buffer.getOccupancy() <= 0) { bytesUntilSpilling = 0; bytesUntilSpilling -= buffer.getCapacity(); if (bytesUntilSpilling <= 0) { bytesUntilSpilling = 0; bytesUntilSpilling -= buffer.getCapacity(); if (bytesUntilSpilling <= 0) { bytesUntilSpilling = 0; while (isRunning() && ((newCurrent = reader.next(current)) != null)) { current = newCurrent; if (!buffer.write(current)) {
private void collectSorted(T record) throws Exception { // try writing to the sorter first if (!sorter.write(record)) { // it didn't succeed; sorter is full // do the actual sorting, combining, and data writing sortAndCombine(); sorter.reset(); // write the value again if (!sorter.write(record)) { throw new IOException("Cannot write record to fresh sort buffer. Record too large."); } } }
if (!sorter.isEmpty()) { this.sortAlgo.sort(sorter); final ReusingKeyGroupedIterator<IN> keyIter = new ReusingKeyGroupedIterator<IN>(sorter.getIterator(), this.serializer, this.groupingComparator); if (!sorter.isEmpty()) { this.sortAlgo.sort(sorter); final NonReusingKeyGroupedIterator<IN> keyIter = new NonReusingKeyGroupedIterator<IN>(sorter.getIterator(), this.groupingComparator);
@Override public void cleanup() throws Exception { if (this.sorter != null) { this.sorter.dispose(); } this.taskContext.getMemoryManager().release(this.memory); }
@Override public E next() { if (this.position <= this.last) { try { E record; if (objectReuseEnabled) { record = this.buffer.getRecord(this.recordReuse, this.position); } else { record = this.buffer.getRecord(this.position); } this.position++; return record; } catch (IOException ioex) { LOG.error("Error retrieving a value from a buffer.", ioex); throw new RuntimeException("Could not load the next value: " + ioex.getMessage(), ioex); } } else { throw new NoSuchElementException(); } }
if (!buffer.isEmpty()) { throw new IOException("New buffer is not empty."); if (!buffer.write(leftoverRecord)) { + buffer.getCapacity() + " bytes)."); buffer.reset(); if (bytesUntilSpilling > 0 && buffer.getCapacity() >= bytesUntilSpilling) if (!buffer.write(current)) { leftoverRecord = current; fullBuffer = true; if (bytesUntilSpilling - buffer.getOccupancy() <= 0) { bytesUntilSpilling = 0; bytesUntilSpilling -= buffer.getCapacity(); if (bytesUntilSpilling <= 0) { bytesUntilSpilling = 0; bytesUntilSpilling -= buffer.getCapacity(); if (bytesUntilSpilling <= 0) { bytesUntilSpilling = 0; while (isRunning() && ((newCurrent = reader.next(current)) != null)) { current = newCurrent; if (!buffer.write(current)) {
private void collectSorted(T record) throws Exception { // try writing to the sorter first if (!sorter.write(record)) { // it didn't succeed; sorter is full // do the actual sorting, combining, and data writing sortAndCombine(); sorter.reset(); // write the value again if (!sorter.write(record)) { throw new IOException("Cannot write record to fresh sort buffer. Record too large."); } } }