### Elasticsearch Version

main

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

Darwin

### Problem Description

Sorting fails sometimes with the error

```
No TopN sorting encoder for type UNSUPPORTED
```


### Steps to Reproduce

Playing with ES|QL I tried to run the following query

`from logstash-* | sort extension.keyword`

This returns the error

```
No TopN sorting encoder for type UNSUPPORTED
```

If I run the query:

`from logstash-*  | keep extension.keyword | sort extension.keyword`

the data return successfully.

### Logs (if relevant)

_No response_
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/LocalExecutionPlanner.java
}
        void driverParallelism(DriverParallelism parallelism) {
            driverParallelism.set(parallelism);
        }
        int pageSize(Integer estimatedRowSize) {
            if (estimatedRowSize == null) {
                throw new IllegalStateException("estimated row size hasn't been set");
            }
            if (estimatedRowSize == 0) {
                throw new IllegalStateException("estimated row size can't be 0");
            }
            if (configuredPageSize != 0) {
                return configuredPageSize;
            }
            return Math.max(SourceOperator.MIN_TARGET_PAGE_SIZE, SourceOperator.TARGET_PAGE_SIZE / estimatedRowSize);
        }
    }
    record DriverSupplier(BigArrays bigArrays, BlockFactory blockFactory, PhysicalOperation physicalOperation, TimeValue statusInterval)
        implements
            Function<String, Driver>,
            Describable {
        @Override
        public Driver apply(String sessionId) {
            SourceOperator source = null;
            List<Operator> operators = new ArrayList<>();
            SinkOperator sink = null;
            boolean success = false;
            var driverContext = new DriverContext(bigArrays, blockFactory);
            try {
                source = physicalOperation.source(driverContext);