use of org.apache.ignite.internal.sql.engine.rel.IgniteSender in project ignite-3 by apache.
the class QueryTemplate method replace.
private List<Fragment> replace(List<Fragment> fragments, Fragment fragment, List<Fragment> replacement) {
assert !nullOrEmpty(replacement);
Long2LongOpenHashMap newTargets = new Long2LongOpenHashMap();
for (Fragment fragment0 : replacement) {
for (IgniteReceiver remote : fragment0.remotes()) {
newTargets.put(remote.exchangeId(), fragment0.fragmentId());
}
}
List<Fragment> fragments0 = new ArrayList<>(fragments.size() + replacement.size() - 1);
for (Fragment fragment0 : fragments) {
if (fragment0 == fragment) {
fragment0 = first(replacement);
} else if (!fragment0.rootFragment()) {
IgniteSender sender = (IgniteSender) fragment0.root();
long newTargetId = newTargets.getOrDefault(sender.exchangeId(), Long.MIN_VALUE);
if (newTargetId != Long.MIN_VALUE) {
sender = new IgniteSender(sender.getCluster(), sender.getTraitSet(), sender.getInput(), sender.exchangeId(), newTargetId, sender.distribution());
fragment0 = new Fragment(fragment0.fragmentId(), sender, fragment0.remotes());
}
}
fragments0.add(fragment0);
}
fragments0.addAll(replacement.subList(1, replacement.size()));
return fragments0;
}
use of org.apache.ignite.internal.sql.engine.rel.IgniteSender in project ignite-3 by apache.
the class Splitter method visit.
/**
* {@inheritDoc}
*/
@Override
public IgniteRel visit(IgniteExchange rel) {
RelOptCluster cluster = rel.getCluster();
long targetFragmentId = curr.id;
long sourceFragmentId = IdGenerator.nextId();
long exchangeId = sourceFragmentId;
IgniteReceiver receiver = new IgniteReceiver(cluster, rel.getTraitSet(), rel.getRowType(), exchangeId, sourceFragmentId);
IgniteSender sender = new IgniteSender(cluster, rel.getTraitSet(), rel.getInput(), exchangeId, targetFragmentId, rel.distribution());
curr.remotes.add(receiver);
stack.push(new FragmentProto(sourceFragmentId, sender));
return receiver;
}
use of org.apache.ignite.internal.sql.engine.rel.IgniteSender 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