Class ExplainPlanTransformer

java.lang.Object
org.elasticsearch.xpack.esql.planner.ExplainPlanTransformer

public final class ExplainPlanTransformer extends Object
Transforms a physical plan for EXPLAIN mode by replacing data source nodes with empty local sources. This makes execution essentially free while preserving the plan structure for profiling.
  • Method Details

    • replaceDataSourcesWithEmpty

      public static PhysicalPlan replaceDataSourcesWithEmpty(PhysicalPlan plan)
      Transforms the plan by replacing data source nodes with empty LocalSourceExec. This preserves the plan structure but makes execution cheap since no data is read. Handles both ES data sources and external data sources (Iceberg, Parquet, S3, etc.).
      Parameters:
      plan - the original physical plan
      Returns:
      a transformed plan with empty data sources