Class SimpleSourceMetadata

java.lang.Object
org.elasticsearch.xpack.esql.datasources.spi.SimpleSourceMetadata
All Implemented Interfaces:
SourceMetadata

public final class SimpleSourceMetadata extends Object implements SourceMetadata
Simple immutable implementation of SourceMetadata. Suitable for use by FormatReader implementations and as a base for table-based sources that need to pass through opaque metadata.
  • Constructor Details

  • Method Details

    • schema

      public List<Attribute> schema()
      Description copied from interface: SourceMetadata
      Returns the resolved schema as ESQL attributes. The attributes represent the columns available for querying.
      Specified by:
      schema in interface SourceMetadata
      Returns:
      list of attributes representing the schema, never null
    • sourceType

      public String sourceType()
      Description copied from interface: SourceMetadata
      Returns the source type identifier. Examples: "parquet", "iceberg", "csv", "delta"
      Specified by:
      sourceType in interface SourceMetadata
      Returns:
      the source type string, never null
    • location

      public String location()
      Description copied from interface: SourceMetadata
      Returns the original path or location of the source. This is the URI or path used to access the data.
      Specified by:
      location in interface SourceMetadata
      Returns:
      the location string, never null
    • statistics

      public Optional<SourceStatistics> statistics()
      Description copied from interface: SourceMetadata
      Returns optional statistics for query planning. Statistics can include row counts, column statistics, etc.
      Specified by:
      statistics in interface SourceMetadata
      Returns:
      optional statistics, empty if not available
    • partitionColumns

      public Optional<List<String>> partitionColumns()
      Description copied from interface: SourceMetadata
      Returns optional partition column names. For partitioned data sources, this indicates which columns are used for partitioning.
      Specified by:
      partitionColumns in interface SourceMetadata
      Returns:
      optional list of partition column names, empty if not partitioned
    • sourceMetadata

      public Map<String,Object> sourceMetadata()
      Description copied from interface: SourceMetadata
      Returns opaque source-specific metadata.

      This is used by table-based sources (Iceberg, Delta Lake) to pass native schema and other source-specific data through to the operator factory without core needing to understand it.

      For example, Iceberg stores its native Schema object here under a well-known key. The Iceberg operator factory retrieves it when creating operators, avoiding the need to re-resolve the table.

      File-based sources typically return an empty map since the schema is embedded in the file itself.

      Specified by:
      sourceMetadata in interface SourceMetadata
      Returns:
      map of source-specific metadata, never null
    • config

      public Map<String,Object> config()
      Description copied from interface: SourceMetadata
      Returns configuration for operator creation.

      This replaces source-specific configuration classes (like S3Configuration) leaking into core. Configuration is stored as a generic map that the source-specific operator factory interprets.

      Common keys include:

      • "access_key" - S3 access key
      • "secret_key" - S3 secret key
      • "endpoint" - S3 endpoint URL
      • "region" - AWS region
      Specified by:
      config in interface SourceMetadata
      Returns:
      configuration map, never null
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • builder

      public static SimpleSourceMetadata.Builder builder()
      Creates a builder for constructing SimpleSourceMetadata instances.