### 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
| sort z""");
        var topN = as(plan, TopN.class);
        assertThat(orderNames(topN), contains("z", "emp_no"));
        var eval = as(topN.child(), Eval.class);
        assertThat(Expressions.names(eval.fields()), contains("x", "y", "z"));
        as(eval.child(), EsRelation.class);
    }
    public void testCombineOrderByThroughDissect() {
        LogicalPlan plan = optimizedPlan("""
            from test
            | sort emp_no
            | dissect first_name "%{x}"
            | sort x""");
        var topN = as(plan, TopN.class);
        assertThat(orderNames(topN), contains("x", "emp_no"));
        var dissect = as(topN.child(), Dissect.class);
        as(dissect.child(), EsRelation.class);
    }
    public void testCombineOrderByThroughGrok() {
        LogicalPlan plan = optimizedPlan("""
            from test
            | sort emp_no
            | grok first_name "%{WORD:x}"
            | sort x""");
        var topN = as(plan, TopN.class);
        assertThat(orderNames(topN), contains("x", "emp_no"));
        var grok = as(topN.child(), Grok.class);
        as(grok.child(), EsRelation.class);
    }
    public void testCombineOrderByThroughProject() {