continue;
}
for (RequestedGlobalProperties igps: this.channelProps) {
// create a candidate channel for the first input. mark it cached, if the connection says so
Channel c1 = new Channel(child1, this.input1.getMaterializationMode());
if (this.input1.getShipStrategy() == null) {
// free to choose the ship strategy
igps.parameterizeChannel(c1, globalDopChange1, localDopChange1);
// if the DOP changed, make sure that we cancel out properties, unless the
// ship strategy preserves/establishes them even under changing DOPs
if (globalDopChange1 && !c1.getShipStrategy().isNetworkStrategy()) {
c1.getGlobalProperties().reset();
}
if (localDopChange1 && !(c1.getShipStrategy().isNetworkStrategy() ||
c1.getShipStrategy().compensatesForLocalDOPChanges())) {
c1.getGlobalProperties().reset();
}
} else {
// ship strategy fixed by compiler hint
if (this.keys1 != null) {
c1.setShipStrategy(this.input1.getShipStrategy(), this.keys1.toFieldList());
} else {
c1.setShipStrategy(this.input1.getShipStrategy());
}
if (globalDopChange1) {
c1.adjustGlobalPropertiesForFullParallelismChange();
} else if (localDopChange1) {
c1.adjustGlobalPropertiesForLocalParallelismChange();
}
}
// create a candidate channel for the first input. mark it cached, if the connection says so
Channel c2 = new Channel(child2, this.input2.getMaterializationMode());
if (this.input2.getShipStrategy() == null) {
// free to choose the ship strategy
igps.parameterizeChannel(c2, globalDopChange2, localDopChange2);
// if the DOP changed, make sure that we cancel out properties, unless the
// ship strategy preserves/establishes them even under changing DOPs
if (globalDopChange2 && !c2.getShipStrategy().isNetworkStrategy()) {
c2.getGlobalProperties().reset();
}
if (localDopChange2 && !(c2.getShipStrategy().isNetworkStrategy() ||
c2.getShipStrategy().compensatesForLocalDOPChanges())) {
c2.getGlobalProperties().reset();
}
} else {
// ship strategy fixed by compiler hint
if (this.keys2 != null) {
c2.setShipStrategy(this.input2.getShipStrategy(), this.keys2.toFieldList());
} else {
c2.setShipStrategy(this.input2.getShipStrategy());
}
if (globalDopChange2) {
c2.adjustGlobalPropertiesForFullParallelismChange();
} else if (localDopChange2) {
c2.adjustGlobalPropertiesForLocalParallelismChange();
}
}
// get the global properties and clear unique fields (not preserved anyways during the union)
GlobalProperties p1 = c1.getGlobalProperties();
GlobalProperties p2 = c2.getGlobalProperties();
p1.clearUniqueFieldCombinations();
p2.clearUniqueFieldCombinations();
// adjust the partitionings, if they exist but are not equal. this may happen when both channels have a
// partitioning that fulfills the requirements, but both are incompatible. For example may a property requirement
// be ANY_PARTITIONING on fields (0) and one channel is range partitioned on that field, the other is hash
// partitioned on that field.
if (!igps.isTrivial() && !(p1.equals(p2))) {
if (c1.getShipStrategy() == ShipStrategyType.FORWARD && c2.getShipStrategy() != ShipStrategyType.FORWARD) {
// adjust c2 to c1
c2 = c2.clone();
p1.parameterizeChannel(c2,globalDopChange2);
} else if (c2.getShipStrategy() == ShipStrategyType.FORWARD && c1.getShipStrategy() != ShipStrategyType.FORWARD) {
// adjust c1 to c2
c1 = c1.clone();
p2.parameterizeChannel(c1,globalDopChange1);
} else if (c1.getShipStrategy() == ShipStrategyType.FORWARD && c2.getShipStrategy() == ShipStrategyType.FORWARD) {
boolean adjustC1 = c1.getEstimatedOutputSize() <= 0 || c2.getEstimatedOutputSize() <= 0 ||
c1.getEstimatedOutputSize() <= c2.getEstimatedOutputSize();
if (adjustC1) {
c2 = c2.clone();
p1.parameterizeChannel(c2, globalDopChange2);
} else {
c1 = c1.clone();
p2.parameterizeChannel(c1, globalDopChange1);
}