class Axiom::Optimizer::Algebra::Join::MaterializedRight

Optimize when the right operand is materialized

Public Instance Methods

optimizable?() click to toggle source

Test if the right operand is materialized

@return [Boolean]

@api private

# File lib/axiom/optimizer/algebra/join.rb, line 133
def optimizable?
  right.materialized? && !left_matching_right?
end
optimize() click to toggle source

Return the join of the left and right with the left restricted

@return [Algebra::Join]

@api private

# File lib/axiom/optimizer/algebra/join.rb, line 142
def optimize
  left.restrict(materialized_predicate).join(right)
end

Private Instance Methods

left_matching_right?() click to toggle source

Test if the left operand is a restriction matching the right

@return [Boolean]

@api private

# File lib/axiom/optimizer/algebra/join.rb, line 153
def left_matching_right?
  left.kind_of?(Axiom::Algebra::Restriction) && left.predicate.eql?(materialized_predicate)
end
matching_projection() click to toggle source

Return a the matching projection of the materializd relation

@return [Projection]

@api private

# File lib/axiom/optimizer/algebra/join.rb, line 162
def matching_projection
  right.project(join_key)
end