Sha256: 43229077dea62f3767e32f6f8909572da9791ec1d08a88c82f72b54ad4a66d63

Contents?: true

Size: 1.66 KB

Versions: 3

Compression:

Stored size: 1.66 KB

Contents

# encoding: utf-8

module Veritas
  class Optimizer
    module Algebra

      # Abstract base class representing Intersection optimizations
      class Intersection < Relation::Operation::Binary

        # Optimize when operands are equal
        class EqualOperands < self
          include Relation::Operation::Binary::EqualOperands

          # An Intersection with equal operands is equivalent to either operand
          #
          # @return [Relation]
          #
          # @api private
          def optimize
            left
          end

        end # class EqualOperands

        # Optimize when the left operand is empty
        class EmptyLeft < self
          include Relation::Operation::Binary::EmptyLeft

          # An Intersection with an empty left operand is empty
          #
          # @return [Relation::Empty]
          #
          # @api private
          def optimize
            left
          end

        end # class EmptyLeft

        # Optimize when the right operand is empty
        class EmptyRight < self
          include Relation::Operation::Binary::EmptyRight

          # An Intersection with an empty right operand is empty
          #
          # @return [Relation::Empty]
          #
          # @api private
          def optimize
            right
          end

        end # class EmptyRight

        Veritas::Algebra::Intersection.optimizer = chain(
          EqualOperands,
          EmptyLeft,
          EmptyRight,
          LeftOrderOperand,
          RightOrderOperand,
          MaterializedOperands,
          UnoptimizedOperands
        )

      end # class Intersection
    end # module Algebra
  end # class Optimizer
end # module Veritas

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 lib/veritas/optimizer/algebra/intersection.rb
veritas-optimizer-0.0.6 lib/veritas/optimizer/algebra/intersection.rb
veritas-optimizer-0.0.5 lib/veritas/optimizer/algebra/intersection.rb