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
for (int i = 0; i < blocks.length; i++) {
                blocks[i] = p.getBlock(mappedPosition[i]);
                blocks[i].incRef();
            }
            p.releaseBlocks();
            return new Page(blocks);
        } : Function.identity();
        return transformer;
    }
    private PhysicalOperation planExchange(ExchangeExec exchangeExec, LocalExecutionPlannerContext context) {
        throw new UnsupportedOperationException("Exchange needs to be replaced with a sink/source");
    }
    private PhysicalOperation planExchangeSink(ExchangeSinkExec exchangeSink, LocalExecutionPlannerContext context) {
        Objects.requireNonNull(exchangeSinkHandler, "ExchangeSinkHandler wasn't provided");
        var child = exchangeSink.child();
        
        
        
        if (child instanceof LocalSourceExec localExec) {
            var output = exchangeSink.output();
            var localOutput = localExec.output();
            if (output.equals(localOutput) == false) {
                
                List<Block> blocks = new ArrayList<>(asList(localExec.supplier().get()));
                if (blocks.size() > 0) {
                    for (int i = 0, s = output.size(); i < s; i++) {
                        var out = output.get(i);
                        if (out.dataType() == DataTypes.BOOLEAN) {
                            blocks.add(i, BlockFactory.getNonBreakingInstance().newConstantBooleanBlockWith(true, 1));
                        }