Sha256: 2074c2acfda044056f8efce02b70611a0a699b98329ad52805f2802bb1392bd5

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8

module Veritas
  class Optimizer
    module Algebra

      # Abstract base class representing Join optimizations
      class Join < Relation::Operation::Combination

        # Optimize when operands' headers are equal
        class EqualHeaders < self

          # Test if the operands' headers are equal to the join's headers
          #
          # @return [Boolean]
          #
          # @api private
          def optimizable?
            left.header.eql?(right.header)
          end

          # A Join with an equal header is an Intersection
          #
          # @return [Algebra::Intersection]
          #
          # @api private
          def optimize
            Veritas::Algebra::Intersection.new(left, right)
          end

        end # class EqualHeaders

        Veritas::Algebra::Join.optimizer = chain(
          EmptyLeft,
          EmptyRight,
          EqualHeaders,
          LeftOrderOperand,
          RightOrderOperand,
          MaterializedOperand,
          UnoptimizedOperands
        )

      end # class Join
    end # module Algebra
  end # class Optimizer
end # module Veritas

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.4 lib/veritas/optimizer/algebra/join.rb