Class FileSplitProvider
java.lang.Object
org.elasticsearch.xpack.esql.datasources.FileSplitProvider
- All Implemented Interfaces:
SplitProvider
Default
SplitProvider for file-based sources.
Converts each file in the FileList into a FileSplit,
applying L1 partition pruning when filter hints and partition metadata are available.
When filter hints contain resolved Expression objects, evaluates them against
each file's partition values to prune files that cannot match the filter.
Splitting modes.
This provider supports two distinct splitting strategies. The downstream reader's behaviour
(partial-line skip vs. no skip) differs between them, gated by
FormatReadContext.recordAligned().
- Record-aligned macro splits — for uncompressed line-oriented formats
(NDJSON/JSONL/JSON, CSV/TSV).
RecordSplitter.findNextRecordBoundary(java.io.InputStream)probes neartarget_split_sizestrides so eachFileSplitstarts on a record boundary. Splits are tagged withRECORD_ALIGNED_MACRO_SPLIT_KEYand readers receiverecordAligned=true, so they must not drop any leading bytes. SeetryNewlineAlignedMacroSplits(org.elasticsearch.xpack.esql.datasources.spi.StoragePath, long, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>, org.elasticsearch.xpack.esql.datasources.ColumnMapping, java.util.List<org.elasticsearch.xpack.esql.core.expression.Attribute>, long, int, java.util.List<org.elasticsearch.xpack.esql.datasources.spi.ExternalSplit>, org.elasticsearch.xpack.esql.datasources.spi.StorageProvider, org.elasticsearch.xpack.esql.datasources.spi.FormatReader, java.util.function.BooleanSupplier). - Block-aligned splits — for splittable compressed formats (e.g. bzip2) via
SplittableDecompressionCodec.findBlockBoundaries(org.elasticsearch.xpack.esql.datasources.spi.StorageObject, long, long). Splits land on compression block boundaries, not record boundaries. Readers receiverecordAligned=falseand must skip a leading partial record on every non-first split. SeetryBlockAlignedSplits(org.elasticsearch.xpack.esql.datasources.spi.StoragePath, long, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>, org.elasticsearch.xpack.esql.datasources.ColumnMapping, java.util.List<org.elasticsearch.xpack.esql.core.expression.Attribute>, java.util.List<org.elasticsearch.xpack.esql.datasources.spi.ExternalSplit>, org.elasticsearch.xpack.esql.datasources.spi.StorageProvider).
-
Field Summary
FieldsModifier and TypeFieldDescriptionConfiguration keys this splitter consumes from a query-time configuration map.static final StringFields inherited from interface org.elasticsearch.xpack.esql.datasources.spi.SplitProvider
SINGLE -
Constructor Summary
ConstructorsConstructorDescriptionFileSplitProvider(long targetSplitSizeBytes) FileSplitProvider(long targetSplitSizeBytes, DecompressionCodecRegistry codecRegistry, StorageProviderRegistry storageRegistry, Settings settings) FileSplitProvider(long targetSplitSizeBytes, DecompressionCodecRegistry codecRegistry, StorageProviderRegistry storageRegistry, FormatReaderRegistry formatRegistry, Settings settings) FileSplitProvider(long targetSplitSizeBytes, DecompressionCodecRegistry codecRegistry, StorageProviderRegistry storageRegistry, FormatReaderRegistry formatRegistry, Settings settings, Executor executor) -
Method Summary
Modifier and TypeMethodDescriptiondiscoverSplits(SplitDiscoveryContext context) static booleanWhether this leaf split came fromtryNewlineAlignedMacroSplits(org.elasticsearch.xpack.esql.datasources.spi.StoragePath, long, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>, org.elasticsearch.xpack.esql.datasources.ColumnMapping, java.util.List<org.elasticsearch.xpack.esql.core.expression.Attribute>, long, int, java.util.List<org.elasticsearch.xpack.esql.datasources.spi.ExternalSplit>, org.elasticsearch.xpack.esql.datasources.spi.StorageProvider, org.elasticsearch.xpack.esql.datasources.spi.FormatReader, java.util.function.BooleanSupplier).static StorageObjectstorageObjectForSplit(StorageProvider storageProvider, FileSplit fileSplit) Builds aStorageObjectthat exposes only the bytes for the givenFileSplit.static longvalidateTargetSplitSize(String value) Parses and validates an already-trimmedtarget_split_sizevalue, returning the size in bytes.
-
Field Details
-
CONFIG_TARGET_SPLIT_SIZE
- See Also:
-
CONFIG_KEYS
Configuration keys this splitter consumes from a query-time configuration map. Aggregated byFileSourceFactory.COORDINATOR_KEYS. New keys read by this class viaconfig.get(...)must be added here so theConfigKeyValidatorrecognises them — pinned byFileSourceFactoryValidationTests.
-
-
Constructor Details
-
FileSplitProvider
public FileSplitProvider() -
FileSplitProvider
public FileSplitProvider(long targetSplitSizeBytes) -
FileSplitProvider
public FileSplitProvider(long targetSplitSizeBytes, DecompressionCodecRegistry codecRegistry, StorageProviderRegistry storageRegistry, Settings settings) -
FileSplitProvider
public FileSplitProvider(long targetSplitSizeBytes, DecompressionCodecRegistry codecRegistry, StorageProviderRegistry storageRegistry, FormatReaderRegistry formatRegistry, Settings settings) -
FileSplitProvider
public FileSplitProvider(long targetSplitSizeBytes, DecompressionCodecRegistry codecRegistry, StorageProviderRegistry storageRegistry, FormatReaderRegistry formatRegistry, Settings settings, @Nullable Executor executor)
-
-
Method Details
-
discoverSplits
- Specified by:
discoverSplitsin interfaceSplitProvider
-
storageObjectForSplit
public static StorageObject storageObjectForSplit(StorageProvider storageProvider, FileSplit fileSplit) Builds aStorageObjectthat exposes only the bytes for the givenFileSplit. Always wraps the provider's base object inRangeStorageObjectso format readers and splittable decompressors only see the split's compressed byte span (including offset0). -
isRecordAlignedMacroSplit
Whether this leaf split came fromtryNewlineAlignedMacroSplits(org.elasticsearch.xpack.esql.datasources.spi.StoragePath, long, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>, java.util.Map<java.lang.String, java.lang.Object>, org.elasticsearch.xpack.esql.datasources.ColumnMapping, java.util.List<org.elasticsearch.xpack.esql.core.expression.Attribute>, long, int, java.util.List<org.elasticsearch.xpack.esql.datasources.spi.ExternalSplit>, org.elasticsearch.xpack.esql.datasources.spi.StorageProvider, org.elasticsearch.xpack.esql.datasources.spi.FormatReader, java.util.function.BooleanSupplier). -
validateTargetSplitSize
Parses and validates an already-trimmedtarget_split_sizevalue, returning the size in bytes. Shared by the query path (resolveTargetSplitSize(java.util.Map<java.lang.String, java.lang.Object>)) and the dataset CRUD validator so both accept exactly the same inputs. The caller owns trimming and the null/empty fallback to a default; this method always parses.- Throws:
ElasticsearchParseException- if the unit suffix is missing or malformedIllegalArgumentException- if the resulting size is not positive
-