Sha256: be61e27e18beb0465c7639b4a64b7436f5958904ca58647b22d9fc4cadde0bc8

Contents?: true

Size: 922 Bytes

Versions: 3

Compression:

Stored size: 922 Bytes

Contents

# encoding: utf-8

module Veritas
  class Optimizer
    module Relation

      # Abstract base class representing Materialized optimizations
      class Materialized < Optimizer

        # Optimize when the operand is Empty
        class EmptyOperand < self

          # Test if the operand is empty
          #
          # @return [Boolean]
          #
          # @api private
          def optimizable?
            operation.empty?
          end

          # Return a new Empty relation with the operation's headers
          #
          # @return [Empty]
          #
          # @api private
          def optimize
            Veritas::Relation::Empty.new(operation.header)
          end

        end # class EmptyOperand

        Veritas::Relation::Materialized.optimizer = chain(
          EmptyOperand
        )

      end # class Materialized
    end # module Relation
  end # class Optimizer
end # module Veritas

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.5 lib/veritas/optimizer/relation/materialized.rb
veritas-optimizer-0.0.4 lib/veritas/optimizer/relation/materialized.rb
veritas-optimizer-0.0.3 lib/veritas/optimizer/relation/materialized.rb