Interface IndexedDecompressionCodec
- All Superinterfaces:
DecompressionCodec
Extension of
DecompressionCodec for codecs that support index-based
random access to independently compressed frames. The canonical example is
the Zstandard seekable format, which appends a seek table as a skippable
frame at the end of the file.
When a codec implements this interface and an index is available for a
given file, the split provider can create splits aligned to frame boundaries
without scanning the compressed data for block markers. This is more efficient
than SplittableDecompressionCodec for formats that embed their own index.
If no index is available (e.g. the file was compressed without seekable
support), the codec falls back to stream-only decompression via
DecompressionCodec.decompress(InputStream).
-
Method Summary
Modifier and TypeMethodDescriptiondecompressFrame(StorageObject object, long compressedOffset, long compressedLength) Decompresses a single frame at the given compressed offset and length.booleanhasIndex(StorageObject object) Checks whether the given storage object contains a frame index (e.g.readIndex(StorageObject object) Reads the frame index from the storage object.Methods inherited from interface org.elasticsearch.xpack.esql.datasources.spi.DecompressionCodec
decompress, extensions, name
-
Method Details
-
hasIndex
Checks whether the given storage object contains a frame index (e.g. a seek table appended as a skippable frame).- Throws:
IOException
-
readIndex
Reads the frame index from the storage object. The index describes the compressed offset, compressed size, and decompressed size of each independently decompressible frame.- Throws:
IOException- if the index cannot be read or is malformedUnsupportedOperationException- ifhasIndex(org.elasticsearch.xpack.esql.datasources.spi.StorageObject)returns false
-
decompressFrame
InputStream decompressFrame(StorageObject object, long compressedOffset, long compressedLength) throws IOException Decompresses a single frame at the given compressed offset and length. The returned stream yields the decompressed bytes for that frame only.- Parameters:
object- the storage object containing the compressed datacompressedOffset- byte offset of the frame in the compressed filecompressedLength- byte length of the compressed frame- Returns:
- an input stream yielding decompressed bytes for the frame
- Throws:
IOException
-