Class: Veritas::Optimizer::Algebra::Summarization::EmptyOperand

Inherits:
Veritas::Optimizer::Algebra::Summarization show all
Defined in:
lib/veritas/optimizer/algebra/summarization.rb

Overview

Optimize when the operand is Empty

Constant Summary

Constants inherited from Veritas::Optimizer

Noop, VERSION

Instance Attribute Summary

Attributes inherited from Veritas::Optimizer::Algebra::Summarization

#summarize_per, #summarizers

Attributes inherited from Relation::Operation::Unary

#header

Attributes included from Function::Unary

#operand

Attributes inherited from Veritas::Optimizer

#operation

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Veritas::Optimizer::Algebra::Summarization

#initialize

Methods inherited from Relation::Operation::Unary

#initialize

Methods included from Function::Unary

#initialize

Methods inherited from Veritas::Optimizer

chain, #initialize

Constructor Details

This class inherits a constructor from Veritas::Optimizer::Algebra::Summarization

Class Method Details

.extension_default(function) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return the default value for a function

Parameters:

  • function (Object)

Returns:

  • (Object)


78
79
80
81
82
# File 'lib/veritas/optimizer/algebra/summarization.rb', line 78

def self.extension_default(function)
  if function.respond_to?(:default)
    function.finalize(function.default)
  end
end

Instance Method Details

#optimizable?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if the operand is empty

Returns:

  • (Boolean)


89
90
91
# File 'lib/veritas/optimizer/algebra/summarization.rb', line 89

def optimizable?
  operand.kind_of?(Veritas::Relation::Empty)
end

#optimizeExtension

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return an extended relation with the same headers

Returns:



98
99
100
101
102
103
104
# File 'lib/veritas/optimizer/algebra/summarization.rb', line 98

def optimize
  summarize_per.extend do |context|
    extensions.each do |extension|
      context.add(*extension)
    end
  end
end