use of org.apache.ignite.internal.sql.engine.rel.IgniteTrimExchange in project ignite-3 by apache.
the class TraitUtils method convertDistribution.
/**
* Convert distribution. TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@Nullable
public static RelNode convertDistribution(RelOptPlanner planner, IgniteDistribution toTrait, RelNode rel) {
IgniteDistribution fromTrait = distribution(rel);
if (fromTrait.satisfies(toTrait)) {
return rel;
}
// key object, thus this conversion is impossible
if (toTrait.function().affinity() && toTrait.getKeys().size() > 1) {
return null;
}
RelTraitSet traits = rel.getTraitSet().replace(toTrait);
if (fromTrait.getType() == BROADCAST_DISTRIBUTED && toTrait.getType() == HASH_DISTRIBUTED) {
return new IgniteTrimExchange(rel.getCluster(), traits, rel, toTrait);
} else {
return new IgniteExchange(rel.getCluster(), traits.replace(RewindabilityTrait.ONE_WAY).replace(CorrelationTrait.UNCORRELATED), RelOptRule.convert(rel, rel.getTraitSet().replace(CorrelationTrait.UNCORRELATED)), toTrait);
}
}
use of org.apache.ignite.internal.sql.engine.rel.IgniteTrimExchange in project ignite-3 by apache.
the class FragmentSplitter method split.
private IgniteRel split(IgniteRel rel) {
RelOptCluster cluster = rel.getCluster();
RelTraitSet traits = rel.getTraitSet();
RelDataType rowType = rel.getRowType();
RelNode input = rel instanceof IgniteTrimExchange ? rel.getInput(0) : rel;
long targetFragmentId = curr.id;
long sourceFragmentId = IdGenerator.nextId();
long exchangeId = sourceFragmentId;
IgniteReceiver receiver = new IgniteReceiver(cluster, traits, rowType, exchangeId, sourceFragmentId);
IgniteSender sender = new IgniteSender(cluster, traits, input, exchangeId, targetFragmentId, rel.distribution());
curr.remotes.add(receiver);
stack.push(new FragmentProto(sourceFragmentId, sender));
return receiver;
}
Aggregations