### Description

In cases where the same agg is used, instead of computing it multiple times, make another reference to it:
```
stats a = min(x), b = min(x) by z
```

should become
```
stats a = min(x) by z
eval b = a
keep a,b,z
```

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java
"languages_idx",
            "mapping-languages.json"
        );
        analyzer = new Analyzer(
            new AnalyzerContext(
                EsqlTestUtils.TEST_CFG,
                new EsqlFunctionRegistry(),
                getIndexResult,
                new EnrichResolution(Set.of(policy), Set.of("languages_idx", "something"))
            ),
            TEST_VERIFIER
        );
    }
    public void testEmptyProjections() {
        var plan = plan("""
            from test
            | keep salary
            | drop salary
            """);
        var relation = as(plan, LocalRelation.class);
        assertThat(relation.output(), is(empty()));
        assertThat(relation.supplier().get(), emptyArray());
    }
    public void testEmptyProjectionInStat() {
        var plan = plan("""
            from test
            | stats c = count(salary)
            | drop c
            """);
        var relation = as(plan, LocalRelation.class);