| 62 | import java.util.function.Supplier; |
| 63 | |
| 64 | public class ReaderImpl implements Reader { |
| 65 | |
| 66 | private static final Logger LOG = LoggerFactory.getLogger(ReaderImpl.class); |
| 67 | |
| 68 | private static final OrcFile.Version[] ORC_FILE_VERSION_VALUES = OrcFile.Version.values(); |
| 69 | private static final OrcFile.WriterVersion[] ORC_FILE_WRITER_VERSION_VALUES |
| 70 | = OrcFile.WriterVersion.values(); |
| 71 | |
| 72 | private static final int DIRECTORY_SIZE_GUESS = 16 * 1024; |
| 73 | public static final int DEFAULT_COMPRESSION_BLOCK_SIZE = 256 * 1024; |
| 74 | |
| 75 | private final long maxLength; |
| 76 | protected final Path path; |
| 77 | protected final OrcFile.ReaderOptions options; |
| 78 | protected final org.apache.orc.CompressionKind compressionKind; |
| 79 | protected FSDataInputStream file; |
| 80 | protected int bufferSize; |
| 81 | // the unencrypted stripe statistics or null if they haven't been read yet |
| 82 | protected List<OrcProto.StripeStatistics> stripeStatistics; |
| 83 | private final int metadataSize; |
| 84 | protected final List<OrcProto.Type> types; |
| 85 | private final TypeDescription schema; |
| 86 | private final List<OrcProto.UserMetadataItem> userMetadata; |
| 87 | private final List<OrcProto.ColumnStatistics> fileStats; |
| 88 | private final List<StripeInformation> stripes; |
| 89 | protected final int rowIndexStride; |
| 90 | private final long contentLength, numberOfRows; |
| 91 | private final ReaderEncryption encryption; |
| 92 | |
| 93 | private long deserializedSize = -1; |
| 94 | protected final Configuration conf; |
| 95 | protected final boolean useUTCTimestamp; |
| 96 | private final List<Integer> versionList; |
| 97 | private final OrcFile.WriterVersion writerVersion; |
| 98 | private final String softwareVersion; |
| 99 | |
| 100 | protected final OrcTail tail; |
| 101 | |
| 102 | public static class StripeInformationImpl |
| 103 | implements StripeInformation { |
| 104 | private final long stripeId; |
| 105 | private final long originalStripeId; |
| 106 | private final byte[][] encryptedKeys; |
| 107 | private final OrcProto.StripeInformation stripe; |
| 108 | |
| 109 | public StripeInformationImpl(OrcProto.StripeInformation stripe, |
| 110 | long stripeId, |
| 111 | long previousOriginalStripeId, |
| 112 | byte[][] previousKeys) { |
| 113 | this.stripe = stripe; |
| 114 | this.stripeId = stripeId; |
| 115 | if (stripe.hasEncryptStripeId()) { |
| 116 | originalStripeId = stripe.getEncryptStripeId(); |
| 117 | } else { |
| 118 | originalStripeId = previousOriginalStripeId + 1; |
| 119 | } |
| 120 | if (stripe.getEncryptedLocalKeysCount() != 0) { |
| 121 | encryptedKeys = new byte[stripe.getEncryptedLocalKeysCount()][]; |
nothing calls this directly
no outgoing calls
no test coverage detected