Consider this query:
which generates this plan:
and after we apply RelFieldTrimmer:
We see that the LogicalAggregate has no groups/functions after applying the trimmer. When we apply ProjectJoinTransposeRule or LoptOptimizeJoinRule after trimming, we are seeing these exceptions:
I think we should either fix the trimmer, or the rules to handle these cases.