return (union.isDistinct() && union.isHomogeneous(false /* don't compare names */));
}
@Override
public void onMatch(RelOptRuleCall call) {
final DrillUnionRel union = (DrillUnionRel) call.rel(0);
final List<RelNode> inputs = union.getInputs();
List<RelNode> convertedInputList = Lists.newArrayList();
RelTraitSet traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL);
try {
for (int i = 0; i < inputs.size(); i++) {
RelNode convertedInput = convert(inputs.get(i), PrelUtil.fixTraits(call, traits));
convertedInputList.add(convertedInput);
}
traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(DrillDistributionTrait.SINGLETON);
UnionDistinctPrel unionDistinct = new UnionDistinctPrel(union.getCluster(), traits, convertedInputList);
call.transformTo(unionDistinct);
} catch (InvalidRelException e) {
tracer.warning(e.toString());