()
| 556 | } |
| 557 | |
| 558 | private void flushStripe() throws IOException { |
| 559 | if (buildIndex && rowsInIndex != 0) { |
| 560 | createRowIndexEntry(); |
| 561 | } |
| 562 | if (rowsInStripe != 0) { |
| 563 | if (callback != null) { |
| 564 | callback.preStripeWrite(callbackContext); |
| 565 | } |
| 566 | // finalize the data for the stripe |
| 567 | int requiredIndexEntries = rowIndexStride == 0 ? 0 : |
| 568 | (int) ((rowsInStripe + rowIndexStride - 1) / rowIndexStride); |
| 569 | OrcProto.StripeFooter.Builder builder = |
| 570 | OrcProto.StripeFooter.newBuilder(); |
| 571 | if (writeTimeZone) { |
| 572 | if (useUTCTimeZone) { |
| 573 | builder.setWriterTimezone("UTC"); |
| 574 | } else { |
| 575 | builder.setWriterTimezone(TimeZone.getDefault().getID()); |
| 576 | } |
| 577 | } |
| 578 | treeWriter.flushStreams(); |
| 579 | treeWriter.writeStripe(requiredIndexEntries); |
| 580 | // update the encodings |
| 581 | builder.addAllColumns(unencryptedEncodings); |
| 582 | unencryptedEncodings.clear(); |
| 583 | for (WriterEncryptionVariant writerEncryptionVariant : encryption) { |
| 584 | OrcProto.StripeEncryptionVariant.Builder encrypt = |
| 585 | OrcProto.StripeEncryptionVariant.newBuilder(); |
| 586 | encrypt.addAllEncoding(writerEncryptionVariant.getEncodings()); |
| 587 | writerEncryptionVariant.clearEncodings(); |
| 588 | builder.addEncryption(encrypt); |
| 589 | } |
| 590 | OrcProto.StripeInformation.Builder dirEntry = |
| 591 | OrcProto.StripeInformation.newBuilder() |
| 592 | .setNumberOfRows(rowsInStripe); |
| 593 | if (encryption.length > 0 && needKeyFlush) { |
| 594 | addEncryptedKeys(dirEntry); |
| 595 | needKeyFlush = false; |
| 596 | } |
| 597 | physicalWriter.finalizeStripe(builder, dirEntry); |
| 598 | |
| 599 | stripes.add(dirEntry.build()); |
| 600 | rowCount += rowsInStripe; |
| 601 | rowsInStripe = 0; |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | private long computeRawDataSize() { |
| 606 | return treeWriter.getRawDataSize(); |
no test coverage detected