### Elasticsearch Version

main@b6747b48ba0901a530ba51375e3576fdb8df8527

### Installed Plugins

_No response_

### Java Version

openjdk version "17.0.8" 2023-07-18

### OS Version

Ubuntu 23.04

### Problem Description

`row a = 1 | stats max(1) by a` (or some other agg) results in:
```
Caused by: java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:233)
	at java.base/java.util.ImmutableCollections$List12.<init>(ImmutableCollections.java:556)
	at java.base/java.util.List.of(List.java:812)
	at org.elasticsearch.xpack.esql.planner.AbstractPhysicalOperationProviders.aggregatesToFactory(AbstractPhysicalOperationProviders.java:185)
	at org.elasticsearch.xpack.esql.planner.AbstractPhysicalOperationProviders.groupingPhysicalOperation(AbstractPhysicalOperationProviders.java:133)
	at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.planAggregation(LocalExecutionPlanner.java:207)
	at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.plan(LocalExecutionPlanner.java:158)
	at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.planAggregation(LocalExecutionPlanner.java:207)
	at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.plan(LocalExecutionPlanner.java:158)
	at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.planLimit(LocalExecutionPlanner.java:520)
	at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.plan(LocalExecutionPlanner.java:176)
	at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.planOutput(LocalExecutionPlanner.java:259)
	at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.plan(LocalExecutionPlanner.java:198)
	at org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.plan(LocalExecutionPlanner.java:147)
	at org.elasticsearch.xpack.esql.plugin.ComputeService.runCompute(ComputeService.java:204)
	... 147 more
```

@nik9000 's thoughts on this: `I think this is just a kind of special case of "I can't EVAL in STATS". But it's a case the parser accepts.`

### Steps to Reproduce

Run the ESQL query from above.

### Logs (if relevant)

_No response_
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java
"1:5: [-] arguments are in unsupported order: cannot subtract a [DATETIME] value [now()] from a [TIME_DURATION] amount [1 "
                    + unit
                    + "]",
                error("row 1 " + unit + " - now() ")
            );
        }
        for (var unit : List.of("day", "week", "month", "year")) {
            assertEquals(
                "1:5: [-] arguments are in unsupported order: cannot subtract a [DATETIME] value [now()] from a [DATE_PERIOD] amount [1 "
                    + unit
                    + "]",
                error("row 1 " + unit + " - now() ")
            );
        }
    }
    public void testPeriodAndDurationInEval() {
        for (var unit : List.of("millisecond", "second", "minute", "hour")) {
            assertEquals(
                "1:18: EVAL does not support type [time_duration] in expression [1 " + unit + "]",
                error("row x = 1 | eval y = 1 " + unit)
            );
        }
        for (var unit : List.of("day", "week", "month", "year")) {
            assertEquals(
                "1:18: EVAL does not support type [date_period] in expression [1 " + unit + "]",
                error("row x = 1 | eval y = 1 " + unit)
            );
        }
    }
    private String error(String query) {