Interface IndexedDecompressionCodec

All Superinterfaces:
DecompressionCodec

public interface IndexedDecompressionCodec extends 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 Details

    • hasIndex

      boolean hasIndex(StorageObject object) throws IOException
      Checks whether the given storage object contains a frame index (e.g. a seek table appended as a skippable frame).
      Throws:
      IOException
    • readIndex

      FrameIndex readIndex(StorageObject object) throws IOException
      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 malformed
      UnsupportedOperationException - if hasIndex(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 data
      compressedOffset - byte offset of the frame in the compressed file
      compressedLength - byte length of the compressed frame
      Returns:
      an input stream yielding decompressed bytes for the frame
      Throws:
      IOException