Record Class FormatReadContext
java.lang.Object
java.lang.Record
org.elasticsearch.xpack.esql.datasources.spi.FormatReadContext
- Record Components:
projectedColumns- columns to read (null or empty means all columns)batchSize- target number of rows per pagerowLimit- maximum total rows to return (FormatReader.NO_LIMITfor unlimited)errorPolicy- how to handle malformed rowsfirstSplit- whether this is the first split for the file (consistent withlastSplit; format-agnostic replacement for the legacyskipFirstLineparameter)lastSplit- whether this is the last split for the file (affects trailing-record handling)
public record FormatReadContext(List<String> projectedColumns, int batchSize, int rowLimit, ErrorPolicy errorPolicy, boolean firstSplit, boolean lastSplit)
extends Record
Immutable context for a single
FormatReader.read(org.elasticsearch.xpack.esql.datasources.spi.StorageObject, org.elasticsearch.xpack.esql.datasources.spi.FormatReadContext) or FormatReader.readAsync(org.elasticsearch.xpack.esql.datasources.spi.StorageObject, org.elasticsearch.xpack.esql.datasources.spi.FormatReadContext, java.util.concurrent.Executor, org.elasticsearch.action.ActionListener<org.elasticsearch.compute.operator.CloseableIterator<org.elasticsearch.compute.data.Page>>) call.
Bundles all per-read execution parameters that were previously spread across 12+ method overloads.
Format-specific configuration (delimiter, encoding, etc.) lives on the reader instance via
FormatReader.withConfig(java.util.Map<java.lang.String, java.lang.Object>). Per-query optimizer hints (pushed filters) live on the reader
instance via FormatReader.withPushedFilter(java.lang.Object). This context carries only the parameters
that may vary per file or per split within a single query execution.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionFormatReadContext(List<String> projectedColumns, int batchSize, int rowLimit, ErrorPolicy errorPolicy, boolean firstSplit, boolean lastSplit) Creates an instance of aFormatReadContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thebatchSizerecord component.static FormatReadContext.Builderbuilder()final booleanIndicates whether some other object is "equal to" this one.Returns the value of theerrorPolicyrecord component.booleanReturns the value of thefirstSplitrecord component.final inthashCode()Returns a hash code value for this object.booleanReturns the value of thelastSplitrecord component.static FormatReadContextCreates a minimal context for the common non-split case.Returns the value of theprojectedColumnsrecord component.introwLimit()Returns the value of therowLimitrecord component.final StringtoString()Returns a string representation of this record class.withErrorPolicy(ErrorPolicy policy) Returns a copy with a different error policy.withRowLimit(int limit) Returns a copy with a different row limit.withSplit(boolean first, boolean last) Returns a copy configured for a split-based read.
-
Constructor Details
-
FormatReadContext
public FormatReadContext(List<String> projectedColumns, int batchSize, int rowLimit, ErrorPolicy errorPolicy, boolean firstSplit, boolean lastSplit) Creates an instance of aFormatReadContextrecord class.- Parameters:
projectedColumns- the value for theprojectedColumnsrecord componentbatchSize- the value for thebatchSizerecord componentrowLimit- the value for therowLimitrecord componenterrorPolicy- the value for theerrorPolicyrecord componentfirstSplit- the value for thefirstSplitrecord componentlastSplit- the value for thelastSplitrecord component
-
-
Method Details
-
of
Creates a minimal context for the common non-split case. -
withRowLimit
Returns a copy with a different row limit. -
withErrorPolicy
Returns a copy with a different error policy. -
withSplit
Returns a copy configured for a split-based read. -
builder
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
projectedColumns
Returns the value of theprojectedColumnsrecord component.- Returns:
- the value of the
projectedColumnsrecord component
-
batchSize
public int batchSize()Returns the value of thebatchSizerecord component.- Returns:
- the value of the
batchSizerecord component
-
rowLimit
public int rowLimit()Returns the value of therowLimitrecord component.- Returns:
- the value of the
rowLimitrecord component
-
errorPolicy
Returns the value of theerrorPolicyrecord component.- Returns:
- the value of the
errorPolicyrecord component
-
firstSplit
public boolean firstSplit()Returns the value of thefirstSplitrecord component.- Returns:
- the value of the
firstSplitrecord component
-
lastSplit
public boolean lastSplit()Returns the value of thelastSplitrecord component.- Returns:
- the value of the
lastSplitrecord component
-