internal FooterInfo( List <StripeStatistics> metadata, OrcProto.Footer footer, FileMetaInfo fileMetaInfo) { this.metadata = metadata; this.footer = footer; this.fileMetaInfo = fileMetaInfo; this.stripes = convertProtoStripesToStripes(footer.StripesList); }
/** Extracts the necessary metadata from an externally store buffer (fullFooterBuffer). */ public static FooterInfo extractMetaInfoFromFooter(ByteBuffer bb, string srcPath) { // Read the PostScript. Be very careful as some parts of this historically use bb position // and some use absolute offsets that have to take position into account. int baseOffset = bb.position(); int lastByteAbsPos = baseOffset + bb.remaining() - 1; int psLen = bb.get(lastByteAbsPos) & 0xff; int psAbsPos = lastByteAbsPos - psLen; OrcProto.PostScript ps = extractPostScript(bb, srcPath, psLen, psAbsPos); Debug.Assert(baseOffset == bb.position()); // Extract PS information. int footerSize = (int)ps.FooterLength, metadataSize = (int)ps.MetadataLength, footerAbsPos = psAbsPos - footerSize, metadataAbsPos = footerAbsPos - metadataSize; CompressionKind compressionKind = (CompressionKind)Enum.Parse(typeof(CompressionKind), ps.Compression.ToString(), true); CompressionCodec codec = WriterImpl.createCodec(compressionKind); int bufferSize = (int)ps.CompressionBlockSize; bb.position(metadataAbsPos); bb.mark(); // Extract metadata and footer. OrcProto.Metadata metadata = extractMetadata( bb, metadataAbsPos, metadataSize, codec, bufferSize); List <StripeStatistics> stats = new List <StripeStatistics>(metadata.StripeStatsCount); foreach (OrcProto.StripeStatistics ss in metadata.StripeStatsList) { stats.Add(new StripeStatistics(ss.ColStatsList)); } OrcProto.Footer footer = extractFooter(bb, footerAbsPos, footerSize, codec, bufferSize); bb.position(metadataAbsPos); bb.limit(psAbsPos); // TODO: do we need footer buffer here? FileInfo/FileMetaInfo is a mess... FileMetaInfo fmi = new FileMetaInfo( compressionKind, bufferSize, metadataSize, bb, extractWriterVersion(ps)); return(new FooterInfo(stats, footer, fmi)); }
ReaderOptions fileMetaInfo(FileMetaInfo info) { _fileMetaInfo = info; return(this); }
ReaderOptions fileMetaInfo(FileMetaInfo info) { _fileMetaInfo = info; return this; }