Hello everyone, the JoinUnionTransposeRule is fired if one of the operands is a Union, but inside the onMatch() method, the code checks if one of the operands is an instance of LogicalUnion [1]*.*
In the Apache Flink SQL implementation, we have created a logical operator FlinkUnion for the translation of union. This operator extends Union and thus when the JoinUnionTransposeRule matches, it throws a ClassCastException. To avoid this, we have copied the JoinUnionTransposeRule over to Flink and changed the check in onMatch() method to look for an instance of Union instead. Obviously, this is not a good choice, since the rule code should not have to be maintained on the Flink side. We are wondering whether this check is a bug or whether we have misunderstood the way we are supposed to use this rule. Thank you, -Vasia. [1]: https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rules/JoinUnionTransposeRule.java#L61
