Interface SegmentableFormatReader

All Superinterfaces:
AutoCloseable, Closeable, FormatReader

public interface SegmentableFormatReader extends FormatReader
Extension of FormatReader for line-oriented text formats (CSV, NDJSON) that support intra-file parallel parsing.

Formats that implement this interface declare they can find record boundaries within an arbitrary byte stream, enabling the framework to split a single file into byte-range segments and parse them concurrently on multiple threads.

Columnar formats (Parquet, ORC) should not implement this interface — they have row-group-level parallelism instead.

  • Field Details

    • DEFAULT_MAX_RECORD_BYTES

      static final int DEFAULT_MAX_RECORD_BYTES
      Default cap on the bytes a single record may occupy; the streaming splitter fails the query rather than buffering past this when a scanner cannot find a boundary. Overridable via the max_record_size pragma.
      See Also:
  • Method Details

    • recordSplitter

      default RecordSplitter recordSplitter()
      Returns the record-boundary splitter for this reader.
    • recordSplitter

      RecordSplitter recordSplitter(int maxRecordBytes)
      Returns the record-boundary splitter with a caller-supplied record-size cap. Implementations report RecordSplitter.RECORD_TOO_LARGE when a record exceeds maxRecordBytes.
    • minimumSegmentSize

      default long minimumSegmentSize()
      Returns the minimum segment size in bytes below which splitting is not worthwhile. Segments smaller than this will be merged with an adjacent segment.

      Defaults to 1 MiB. ClickHouse benchmarks show 1 MiB chunks are optimal for parallel parsing — 100 KB chunks are ~40% slower due to per-chunk overhead, while 10 MiB chunks offer only marginal improvement. Implementations may override to reflect their parsing overhead.