Constructor that let's the user specify additional options. @param path pathname for file @param options options for reading
(Path path, OrcFile.ReaderOptions options)
| 539 | * @param options options for reading |
| 540 | */ |
| 541 | public ReaderImpl(Path path, OrcFile.ReaderOptions options) throws IOException { |
| 542 | this.path = path; |
| 543 | this.options = options; |
| 544 | this.conf = options.getConfiguration(); |
| 545 | this.maxLength = options.getMaxLength(); |
| 546 | this.useUTCTimestamp = options.getUseUTCTimestamp(); |
| 547 | FileMetadata fileMetadata = options.getFileMetadata(); |
| 548 | if (fileMetadata != null) { |
| 549 | this.compressionKind = fileMetadata.getCompressionKind(); |
| 550 | this.bufferSize = fileMetadata.getCompressionBufferSize(); |
| 551 | this.metadataSize = fileMetadata.getMetadataSize(); |
| 552 | this.stripeStatistics = fileMetadata.getStripeStats(); |
| 553 | this.versionList = fileMetadata.getVersionList(); |
| 554 | OrcFile.WriterImplementation writer = |
| 555 | OrcFile.WriterImplementation.from(fileMetadata.getWriterImplementation()); |
| 556 | this.writerVersion = |
| 557 | OrcFile.WriterVersion.from(writer, fileMetadata.getWriterVersionNum()); |
| 558 | List<OrcProto.Type> types = fileMetadata.getTypes(); |
| 559 | OrcUtils.isValidTypeTree(types, 0); |
| 560 | this.schema = OrcUtils.convertTypeFromProtobuf(types, 0); |
| 561 | this.rowIndexStride = fileMetadata.getRowIndexStride(); |
| 562 | this.contentLength = fileMetadata.getContentLength(); |
| 563 | this.numberOfRows = fileMetadata.getNumberOfRows(); |
| 564 | this.fileStats = fileMetadata.getFileStats(); |
| 565 | this.stripes = fileMetadata.getStripes(); |
| 566 | this.tail = null; |
| 567 | this.userMetadata = null; // not cached and not needed here |
| 568 | // FileMetadata is obsolete and doesn't support encryption |
| 569 | this.encryption = new ReaderEncryption(); |
| 570 | this.softwareVersion = null; |
| 571 | } else { |
| 572 | OrcTail orcTail = options.getOrcTail(); |
| 573 | if (orcTail == null) { |
| 574 | tail = extractFileTail(getFileSystem(), path, options.getMaxLength()); |
| 575 | options.orcTail(tail); |
| 576 | } else { |
| 577 | checkOrcVersion(path, orcTail.getPostScript()); |
| 578 | tail = orcTail; |
| 579 | } |
| 580 | this.compressionKind = tail.getCompressionKind(); |
| 581 | this.bufferSize = tail.getCompressionBufferSize(); |
| 582 | this.metadataSize = tail.getMetadataSize(); |
| 583 | this.versionList = tail.getPostScript().getVersionList(); |
| 584 | this.schema = tail.getSchema(); |
| 585 | this.rowIndexStride = tail.getFooter().getRowIndexStride(); |
| 586 | this.contentLength = tail.getFooter().getContentLength(); |
| 587 | this.numberOfRows = tail.getFooter().getNumberOfRows(); |
| 588 | this.userMetadata = tail.getFooter().getMetadataList(); |
| 589 | this.fileStats = tail.getFooter().getStatisticsList(); |
| 590 | this.writerVersion = tail.getWriterVersion(); |
| 591 | this.stripes = tail.getStripes(); |
| 592 | this.stripeStatistics = null; |
| 593 | OrcProto.Footer footer = tail.getFooter(); |
| 594 | this.encryption = new ReaderEncryption(footer, schema, |
| 595 | tail.getStripeStatisticsOffset(), tail.getTailBuffer(), stripes, |
| 596 | options.getKeyProvider(), conf); |
| 597 | this.softwareVersion = OrcUtils.getSoftwareVersion(footer.getWriter(), |
| 598 | footer.getSoftwareVersion()); |
nothing calls this directly
no test coverage detected