Interface SegmentableFormatReader
- All Superinterfaces:
AutoCloseable,Closeable,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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xpack.esql.datasources.spi.FormatReader
FormatReader.SchemaResolution -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault 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.Fields inherited from interface org.elasticsearch.xpack.esql.datasources.spi.FormatReader
DEFAULT_SCHEMA_RESOLUTION, NO_LIMIT -
Method Summary
Modifier and TypeMethodDescriptiondefault longReturns the minimum segment size in bytes below which splitting is not worthwhile.default RecordSplitterReturns the record-boundary splitter for this reader.recordSplitter(int maxRecordBytes) Returns the record-boundary splitter with a caller-supplied record-size cap.Methods inherited from interface org.elasticsearch.xpack.esql.datasources.spi.FormatReader
aggregatePushdownSupport, defaultErrorPolicy, defaultSchemaResolution, fileExtensions, filterPushdownSupport, formatName, metadata, metadataAsync, read, read, readAsync, rowPositionStrategy, schema, statusSnapshot, supportsNativeAsync, supportsWholeFileCompression, withConfig, withConfigTrackingConsumedKeys, withDeclaredDateFormats, withDeclaredTypeColumns, withPushedFilter, withSchema
-
Field Details
-
DEFAULT_MAX_RECORD_BYTES
static final int DEFAULT_MAX_RECORD_BYTESDefault 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 themax_record_sizepragma.- See Also:
-
-
Method Details
-
recordSplitter
Returns the record-boundary splitter for this reader. -
recordSplitter
Returns the record-boundary splitter with a caller-supplied record-size cap. Implementations reportRecordSplitter.RECORD_TOO_LARGEwhen a record exceedsmaxRecordBytes. -
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.
-