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 page
rowLimit - maximum total rows to return (FormatReader.NO_LIMIT for unlimited)
errorPolicy - how to handle malformed rows
firstSplit - whether this is the first split for the file (consistent with lastSplit; format-agnostic replacement for the legacy skipFirstLine parameter)
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.

  • Constructor Details

    • FormatReadContext

      public FormatReadContext(List<String> projectedColumns, int batchSize, int rowLimit, ErrorPolicy errorPolicy, boolean firstSplit, boolean lastSplit)
      Creates an instance of a FormatReadContext record class.
      Parameters:
      projectedColumns - the value for the projectedColumns record component
      batchSize - the value for the batchSize record component
      rowLimit - the value for the rowLimit record component
      errorPolicy - the value for the errorPolicy record component
      firstSplit - the value for the firstSplit record component
      lastSplit - the value for the lastSplit record component
  • Method Details

    • of

      public static FormatReadContext of(List<String> projectedColumns, int batchSize)
      Creates a minimal context for the common non-split case.
    • withRowLimit

      public FormatReadContext withRowLimit(int limit)
      Returns a copy with a different row limit.
    • withErrorPolicy

      public FormatReadContext withErrorPolicy(ErrorPolicy policy)
      Returns a copy with a different error policy.
    • withSplit

      public FormatReadContext withSplit(boolean first, boolean last)
      Returns a copy configured for a split-based read.
    • builder

      public static FormatReadContext.Builder builder()
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • projectedColumns

      public List<String> projectedColumns()
      Returns the value of the projectedColumns record component.
      Returns:
      the value of the projectedColumns record component
    • batchSize

      public int batchSize()
      Returns the value of the batchSize record component.
      Returns:
      the value of the batchSize record component
    • rowLimit

      public int rowLimit()
      Returns the value of the rowLimit record component.
      Returns:
      the value of the rowLimit record component
    • errorPolicy

      public ErrorPolicy errorPolicy()
      Returns the value of the errorPolicy record component.
      Returns:
      the value of the errorPolicy record component
    • firstSplit

      public boolean firstSplit()
      Returns the value of the firstSplit record component.
      Returns:
      the value of the firstSplit record component
    • lastSplit

      public boolean lastSplit()
      Returns the value of the lastSplit record component.
      Returns:
      the value of the lastSplit record component