public boolean isCompatible(boolean compareNames, boolean allowSubstring) { RelDataType unionType = getRowType(); for (RelNode input : getInputs()) { if (! DrillRelOptUtil.areRowTypesCompatible( input.getRowType(), unionType, compareNames, allowSubstring)) { return false; } } return true; }
@Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { // divide cost by two to ensure cheaper than EnumerableDrillRel return super.computeSelfCost(planner, mq).multiplyBy(.5); }
public DrillUnionRelBase(RelOptCluster cluster, RelTraitSet traits, List<RelNode> inputs, boolean all, boolean checkCompatibility) throws InvalidRelException { super(cluster, traits, inputs, all); if (checkCompatibility && !this.isCompatible(false /* don't compare names */, true /* allow substrings */)) { throw new InvalidRelException("Input row types of the Union are not compatible."); } }