MCPcopy Create free account
hub / github.com/apache/orc / spill

Method spill

java/core/src/java/org/apache/orc/impl/OutStream.java:375–414  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

373 }
374
375 private void spill() throws IOException {
376 // if there isn't anything in the current buffer, don't spill
377 if (current == null ||
378 current.position() == (codec == null ? 0 : HEADER_SIZE)) {
379 return;
380 }
381 flip();
382 if (codec == null) {
383 outputBuffer(current);
384 getNewInputBuffer();
385 } else {
386 compressedBuffer.init();
387 int currentPosn = compressedBuffer.getCurrentPosn();
388 compressedBuffer.advanceTo(currentPosn + HEADER_SIZE);
389
390 // Worth compression
391 if (codec.compress(current, compressedBuffer.compressed,
392 compressedBuffer.overflow, options)) {
393 // move position back to after the header
394 uncompressedBytes = 0;
395
396 current.position(HEADER_SIZE);
397 current.limit(current.capacity());
398
399 compressedBytes += compressedBuffer.commitCompress(currentPosn);
400 } else {
401 compressedBytes += uncompressedBytes + HEADER_SIZE;
402 uncompressedBytes = 0;
403
404 compressedBuffer.abortCompress(currentPosn);
405
406 // now add the current buffer into the done list and get a new one.
407 current.position(0);
408 // update the header with the current length
409 writeHeader(current, 0, current.limit() - HEADER_SIZE, true);
410 outputBuffer(current);
411 getNewInputBuffer();
412 }
413 }
414 }
415
416 @Override
417 public void getPosition(PositionRecorder recorder) {

Callers 2

writeMethod · 0.95
flushMethod · 0.95

Calls 11

flipMethod · 0.95
outputBufferMethod · 0.95
getNewInputBufferMethod · 0.95
writeHeaderMethod · 0.95
getCurrentPosnMethod · 0.80
advanceToMethod · 0.80
commitCompressMethod · 0.80
abortCompressMethod · 0.80
compressMethod · 0.65
initMethod · 0.45
capacityMethod · 0.45

Tested by

no test coverage detected