Search in sources :

Example 1 with RewindabilityTrait

use of org.apache.ignite.internal.sql.engine.trait.RewindabilityTrait in project ignite-3 by apache.

the class IgniteCorrelatedNestedLoopJoin method passThroughRewindability.

/**
 * {@inheritDoc}
 */
@Override
public Pair<RelTraitSet, List<RelTraitSet>> passThroughRewindability(RelTraitSet nodeTraits, List<RelTraitSet> inputTraits) {
    // Correlated nested loop requires rewindable right edge.
    RelTraitSet left = inputTraits.get(0);
    RelTraitSet right = inputTraits.get(1);
    RewindabilityTrait rewindability = TraitUtils.rewindability(nodeTraits);
    return Pair.of(nodeTraits.replace(rewindability), List.of(left.replace(rewindability), right.replace(RewindabilityTrait.REWINDABLE)));
}
Also used : RewindabilityTrait(org.apache.ignite.internal.sql.engine.trait.RewindabilityTrait) RelTraitSet(org.apache.calcite.plan.RelTraitSet)

Example 2 with RewindabilityTrait

use of org.apache.ignite.internal.sql.engine.trait.RewindabilityTrait in project ignite-3 by apache.

the class IgniteProject method deriveRewindability.

/**
 * {@inheritDoc}
 */
@Override
public List<Pair<RelTraitSet, List<RelTraitSet>>> deriveRewindability(RelTraitSet nodeTraits, List<RelTraitSet> inputTraits) {
    // The node is rewindable if its input is rewindable.
    RelTraitSet in = inputTraits.get(0);
    RewindabilityTrait rewindability = TraitUtils.rewindability(in);
    return List.of(Pair.of(nodeTraits.replace(rewindability), List.of(in)));
}
Also used : RewindabilityTrait(org.apache.ignite.internal.sql.engine.trait.RewindabilityTrait) RelTraitSet(org.apache.calcite.plan.RelTraitSet)

Example 3 with RewindabilityTrait

use of org.apache.ignite.internal.sql.engine.trait.RewindabilityTrait in project ignite-3 by apache.

the class AbstractIgniteJoin method deriveRewindability.

/**
 * {@inheritDoc}
 */
@Override
public List<Pair<RelTraitSet, List<RelTraitSet>>> deriveRewindability(RelTraitSet nodeTraits, List<RelTraitSet> inputTraits) {
    // The node is rewindable only if both sources are rewindable.
    RelTraitSet left = inputTraits.get(0);
    RelTraitSet right = inputTraits.get(1);
    RewindabilityTrait leftRewindability = TraitUtils.rewindability(left);
    RewindabilityTrait rightRewindability = TraitUtils.rewindability(right);
    List<Pair<RelTraitSet, List<RelTraitSet>>> pairs = new ArrayList<>();
    pairs.add(Pair.of(nodeTraits.replace(RewindabilityTrait.ONE_WAY), List.of(left.replace(RewindabilityTrait.ONE_WAY), right.replace(RewindabilityTrait.ONE_WAY))));
    if (leftRewindability.rewindable() && rightRewindability.rewindable()) {
        pairs.add(Pair.of(nodeTraits.replace(RewindabilityTrait.REWINDABLE), List.of(left.replace(RewindabilityTrait.REWINDABLE), right.replace(RewindabilityTrait.REWINDABLE))));
    }
    return List.copyOf(pairs);
}
Also used : RewindabilityTrait(org.apache.ignite.internal.sql.engine.trait.RewindabilityTrait) ArrayList(java.util.ArrayList) RelTraitSet(org.apache.calcite.plan.RelTraitSet) Pair(org.apache.calcite.util.Pair)

Example 4 with RewindabilityTrait

use of org.apache.ignite.internal.sql.engine.trait.RewindabilityTrait in project ignite-3 by apache.

the class IgniteCorrelatedNestedLoopJoin method deriveRewindability.

/**
 * {@inheritDoc}
 */
@Override
public List<Pair<RelTraitSet, List<RelTraitSet>>> deriveRewindability(RelTraitSet nodeTraits, List<RelTraitSet> inputTraits) {
    // Correlated nested loop requires rewindable right edge.
    RelTraitSet left = inputTraits.get(0);
    RelTraitSet right = inputTraits.get(1);
    RewindabilityTrait rewindability = TraitUtils.rewindability(left);
    return List.of(Pair.of(nodeTraits.replace(rewindability), List.of(left, right.replace(RewindabilityTrait.REWINDABLE))));
}
Also used : RewindabilityTrait(org.apache.ignite.internal.sql.engine.trait.RewindabilityTrait) RelTraitSet(org.apache.calcite.plan.RelTraitSet)

Aggregations

RelTraitSet (org.apache.calcite.plan.RelTraitSet)4 RewindabilityTrait (org.apache.ignite.internal.sql.engine.trait.RewindabilityTrait)4 ArrayList (java.util.ArrayList)1 Pair (org.apache.calcite.util.Pair)1