### 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/LocalPhysicalPlanOptimizerTests.java
var physical = optimizedPlan(physicalPlan(query), stats);
        return physical;
    }
    private PhysicalPlan optimizedPlan(PhysicalPlan plan, SearchStats searchStats) {
        
        var p = EstimatesRowSize.estimateRowSize(0, physicalPlanOptimizer.optimize(plan));
        
        
        
        
        var logicalTestOptimizer = new LocalLogicalPlanOptimizer(new LocalLogicalOptimizerContext(config, searchStats));
        var physicalTestOptimizer = new TestLocalPhysicalPlanOptimizer(new LocalPhysicalOptimizerContext(config, searchStats), true);
        var l = PlannerUtils.localPlan(plan, logicalTestOptimizer, physicalTestOptimizer);
        
        l = PhysicalPlanOptimizerTests.localRelationshipAlignment(l);
        
        return l;
    }
    private PhysicalPlan physicalPlan(String query) {
        var logical = logicalOptimizer.optimize(analyzer.analyze(parser.createStatement(query)));
        
        var physical = mapper.map(logical);
        return physical;
    }
    @Override
    protected List<String> filteredWarnings() {
        return withDefaultLimitWarning(super.filteredWarnings());
    }
}