public void onMatch(RelOptRuleCall call) { UnionRel union = call.rel(0); if (union.all) { return; // nothing to do } UnionRel unionAll = new UnionRel(union.getCluster(), union.getInputs(), true); call.transformTo(RelOptUtil.createDistinctRel(unionAll)); }