[FLINK-1263] [optimizer] Implement compatibility checks for binary operators and custom partitioning

This enhances the optimizer to reuse custom partitionings (created via groupinga and partition operations) in joins, if the same custom partitioning is used on both input data sets.