Description
Currently RemoveEmptySingleRule can only transform SingleRel relations to empty. However, the logic inside the matches method is at the most part capable of handling any kind of relation including those that have multiple children.
By generalizing the RemoveEmptySingleRule to work with arbitrary relations we can refactor other pruning rules such as those created by CorrelateLeftEmptyRuleConfig without the need for creating more classes and duplicating code.
Moreover by changing the constructor to accept PruneEmptyRule.Config instead of RemoveEmptySingleRuleConfig we can reduce code duplication further since configurations such as ZeroMaxRowsRuleConfig and SortFetchZeroRuleConfig could be modified to create instances of RemoveEmptySingleRule.
This is mainly a refactoring to simplify pruning rules and remove duplicate logic. The change is fully backwards compatible.