Search in sources :

Example 1 with IgniteTrimExchange

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);
    }
}
Also used : IgniteTrimExchange(org.apache.ignite.internal.sql.engine.rel.IgniteTrimExchange) RelTraitSet(org.apache.calcite.plan.RelTraitSet) IgniteExchange(org.apache.ignite.internal.sql.engine.rel.IgniteExchange) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with IgniteTrimExchange

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;
}
Also used : RelOptCluster(org.apache.calcite.plan.RelOptCluster) IgniteSender(org.apache.ignite.internal.sql.engine.rel.IgniteSender) RelNode(org.apache.calcite.rel.RelNode) IgniteTrimExchange(org.apache.ignite.internal.sql.engine.rel.IgniteTrimExchange) RelDataType(org.apache.calcite.rel.type.RelDataType) RelTraitSet(org.apache.calcite.plan.RelTraitSet) IgniteReceiver(org.apache.ignite.internal.sql.engine.rel.IgniteReceiver)

Aggregations

RelTraitSet (org.apache.calcite.plan.RelTraitSet)2 IgniteTrimExchange (org.apache.ignite.internal.sql.engine.rel.IgniteTrimExchange)2 RelOptCluster (org.apache.calcite.plan.RelOptCluster)1 RelNode (org.apache.calcite.rel.RelNode)1 RelDataType (org.apache.calcite.rel.type.RelDataType)1 IgniteExchange (org.apache.ignite.internal.sql.engine.rel.IgniteExchange)1 IgniteReceiver (org.apache.ignite.internal.sql.engine.rel.IgniteReceiver)1 IgniteSender (org.apache.ignite.internal.sql.engine.rel.IgniteSender)1 Nullable (org.jetbrains.annotations.Nullable)1