Sha256: c9421c0ff25124af1e4eb3f2fe85de693ffa5cb96d7ae467a5661402c627c954

Contents?: true

Size: 972 Bytes

Versions: 2

Compression:

Stored size: 972 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
            operation = self.operation
            Veritas::Relation::Empty.new(operation.header, operation)
          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

2 entries across 2 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 lib/veritas/optimizer/relation/materialized.rb
veritas-optimizer-0.0.6 lib/veritas/optimizer/relation/materialized.rb