richardstartin commented on a change in pull request #7595: URL: https://github.com/apache/pinot/pull/7595#discussion_r732869947
########## File path: pinot-segment-local/src/main/java/org/apache/pinot/segment/local/io/writer/impl/BaseChunkSVForwardIndexWriter.java ########## @@ -66,19 +68,21 @@ * @param chunkSize Size of chunk * @param sizeOfEntry Size of entry (in bytes), max size for variable byte implementation. * @param version version of File - * @throws FileNotFoundException + * @throws IOException if the file isn't found or can't be mapped */ protected BaseChunkSVForwardIndexWriter(File file, ChunkCompressionType compressionType, int totalDocs, int numDocsPerChunk, int chunkSize, int sizeOfEntry, int version) - throws FileNotFoundException { + throws IOException { Preconditions.checkArgument(version == DEFAULT_VERSION || version == CURRENT_VERSION); + _file = file; + _headerEntryChunkOffsetSize = getHeaderEntryChunkOffsetSize(version); + _dataOffset = headerSize(totalDocs, numDocsPerChunk, _headerEntryChunkOffsetSize); _chunkSize = chunkSize; _chunkCompressor = ChunkCompressorFactory.getCompressor(compressionType); - _headerEntryChunkOffsetSize = getHeaderEntryChunkOffsetSize(version); - _dataOffset = writeHeader(compressionType, totalDocs, numDocsPerChunk, sizeOfEntry, version); _chunkBuffer = ByteBuffer.allocateDirect(chunkSize); - _compressedBuffer = ByteBuffer.allocateDirect(chunkSize * 2); - _dataFile = new RandomAccessFile(file, "rw").getChannel(); + _dataChannel = new RandomAccessFile(file, "rw").getChannel(); + _header = _dataChannel.map(FileChannel.MapMode.READ_WRITE, 0, _dataOffset); Review comment: we don't need it, we just compress directly into the output file -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org