The following query

```
row  a = \"a\", b = 1 | stats  e = min(b) by a | dissect a \"%{e}\" | mv_expand e
```


throws an IndexOutOfBoundsException when building the layout for MV_EXPAND.


x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/LocalExecutionPlanner.java
var source = plan(aggregate.child(), context);
        return physicalOperationProviders.groupingPhysicalOperation(aggregate, source, context);
    }
    private PhysicalOperation planEsQueryNode(EsQueryExec esQueryExec, LocalExecutionPlannerContext context) {
        return physicalOperationProviders.sourcePhysicalOperation(esQueryExec, context);
    }
    private PhysicalOperation planEsStats(EsStatsQueryExec statsQuery, LocalExecutionPlannerContext context) {
        if (physicalOperationProviders instanceof EsPhysicalOperationProviders == false) {
            throw new EsqlIllegalArgumentException("EsStatsQuery should only occur against a Lucene backend");
        }
        if (statsQuery.stats().size() > 1) {
            throw new EsqlIllegalArgumentException("EsStatsQuery currently supports only one field statistic");
        }
        
        EsStatsQueryExec.Stat stat = statsQuery.stats().get(0);
        EsPhysicalOperationProviders esProvider = (EsPhysicalOperationProviders) physicalOperationProviders;
        Function<SearchContext, Query> querySupplier = EsPhysicalOperationProviders.querySupplier(stat.filter(statsQuery.query()));
        Expression limitExp = statsQuery.limit();
        int limit = limitExp != null ? (Integer) limitExp.fold() : NO_LIMIT;
        final LuceneOperator.Factory luceneFactory = new LuceneCountOperator.Factory(
            esProvider.searchContexts(),
            querySupplier,
            context.queryPragmas.dataPartitioning(),
            context.queryPragmas.taskConcurrency(),
            limit
        );
        Layout.Builder layout = new Layout.Builder();
        layout.append(statsQuery.outputSet());
        int instanceCount = Math.max(1, luceneFactory.taskConcurrency());
        context.driverParallelism(new DriverParallelism(DriverParallelism.Type.DATA_PARALLELISM, instanceCount));