class Axiom::Optimizer::Algebra::Join::MaterializedLeft

Optimize when the left operand is materialized

Public Instance Methods

optimizable?() click to toggle source

Test if the left operand is materialized

@return [Boolean]

@api private

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

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

@return [Algebra::Join]

@api private

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

Private Instance Methods

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 119
def matching_projection
  left.project(join_key)
end
right_matching_left?() click to toggle source

Test if the right operand is a restriction matching the left

@return [Boolean]

@api private

# File lib/axiom/optimizer/algebra/join.rb, line 110
def right_matching_left?
  right.kind_of?(Axiom::Algebra::Restriction) && right.predicate.eql?(materialized_predicate)
end