Prune Project's input if project has no RexInputRef and the input has 1 row. The idea is to improve SQL
In this case, we can safely prune the Aggregate. To be more specifically, I'm proposing to match a Project -> Aggregate, and the Project has not field reference from the Aggregate, and the Aggregate's grouping list is empty (which means it will produce 1 row exactly), in this case, we can optimize it to Project -> Values(1) to eliminate the Aggregate.
This idea is brought up in the discussion of
We can add this improvement to ProjectAggregateMergeRule.