Sha256: 8f77dfda0250f92305859c051d7ab38d726a65f3a6643b9a19365a0478165794

Contents?: true

Size: 914 Bytes

Versions: 2

Compression:

Stored size: 914 Bytes

Contents

# encoding: utf-8

module Axiom
  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
            Axiom::Relation::Empty.new(operation.header)
          end

        end # class EmptyOperand

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

      end # class Materialized
    end # module Relation
  end # class Optimizer
end # module Axiom

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 lib/axiom/optimizer/relation/materialized.rb
axiom-optimizer-0.1.1 lib/axiom/optimizer/relation/materialized.rb