Class: Veritas::Optimizer
- Inherits:
-
Object
- Object
- Veritas::Optimizer
- Includes:
- AbstractClass, Immutable
- Defined in:
- lib/veritas/optimizer.rb,
lib/veritas/optimizer/version.rb,
lib/veritas/optimizer/function.rb,
lib/veritas/optimizer/aggregate.rb,
lib/veritas/optimizer/optimizable.rb,
lib/veritas/optimizer/algebra/join.rb,
lib/veritas/optimizer/aggregate/sum.rb,
lib/veritas/optimizer/algebra/union.rb,
lib/veritas/optimizer/aggregate/mean.rb,
lib/veritas/optimizer/algebra/rename.rb,
lib/veritas/optimizer/function/unary.rb,
lib/veritas/optimizer/aggregate/count.rb,
lib/veritas/optimizer/algebra/product.rb,
lib/veritas/optimizer/function/binary.rb,
lib/veritas/optimizer/function/numeric.rb,
lib/veritas/optimizer/aggregate/maximum.rb,
lib/veritas/optimizer/aggregate/minimum.rb,
lib/veritas/optimizer/algebra/extension.rb,
lib/veritas/optimizer/aggregate/variance.rb,
lib/veritas/optimizer/algebra/difference.rb,
lib/veritas/optimizer/algebra/projection.rb,
lib/veritas/optimizer/function/predicate.rb,
lib/veritas/optimizer/algebra/restriction.rb,
lib/veritas/optimizer/algebra/intersection.rb,
lib/veritas/optimizer/algebra/summarization.rb,
lib/veritas/optimizer/relation/materialized.rb,
lib/veritas/optimizer/function/string/length.rb,
lib/veritas/optimizer/function/numeric/modulo.rb,
lib/veritas/optimizer/function/predicate/match.rb,
lib/veritas/optimizer/relation/operation/limit.rb,
lib/veritas/optimizer/relation/operation/order.rb,
lib/veritas/optimizer/relation/operation/unary.rb,
lib/veritas/optimizer/function/numeric/absolute.rb,
lib/veritas/optimizer/function/numeric/addition.rb,
lib/veritas/optimizer/function/numeric/division.rb,
lib/veritas/optimizer/relation/operation/binary.rb,
lib/veritas/optimizer/relation/operation/offset.rb,
lib/veritas/optimizer/function/connective/binary.rb,
lib/veritas/optimizer/relation/operation/reverse.rb,
lib/veritas/optimizer/function/numeric/unary_plus.rb,
lib/veritas/optimizer/function/predicate/equality.rb,
lib/veritas/optimizer/function/predicate/no_match.rb,
lib/veritas/optimizer/support/predicate_partition.rb,
lib/veritas/optimizer/aggregate/standard_deviation.rb,
lib/veritas/optimizer/function/connective/negation.rb,
lib/veritas/optimizer/function/numeric/square_root.rb,
lib/veritas/optimizer/function/numeric/subtraction.rb,
lib/veritas/optimizer/function/numeric/unary_minus.rb,
lib/veritas/optimizer/function/predicate/exclusion.rb,
lib/veritas/optimizer/function/predicate/inclusion.rb,
lib/veritas/optimizer/function/predicate/less_than.rb,
lib/veritas/optimizer/function/predicate/comparable.rb,
lib/veritas/optimizer/function/predicate/enumerable.rb,
lib/veritas/optimizer/function/predicate/inequality.rb,
lib/veritas/optimizer/relation/operation/combination.rb,
lib/veritas/optimizer/function/connective/conjunction.rb,
lib/veritas/optimizer/function/connective/disjunction.rb,
lib/veritas/optimizer/function/numeric/exponentiation.rb,
lib/veritas/optimizer/function/numeric/multiplication.rb,
lib/veritas/optimizer/function/predicate/greater_than.rb,
lib/veritas/optimizer/function/predicate/less_than_or_equal_to.rb,
lib/veritas/optimizer/function/predicate/greater_than_or_equal_to.rb
Overview
A optimization for an operation
Direct Known Subclasses
Aggregate, Function::Connective::Binary, Function::Connective::Negation, Function::Numeric, Function::Predicate, Function::String::Length, Relation::Materialized, Relation::Operation::Binary, Relation::Operation::Unary
Defined Under Namespace
Modules: Algebra, Function, Optimizable, Relation Classes: Aggregate, PredicatePartition
Constant Summary collapse
- Noop =
A noop optimizer that returns the operation as-is
lambda { |operation| operation }.freeze
- VERSION =
'0.0.7'
Instance Attribute Summary collapse
-
#operation ⇒ Optimizable
readonly
private
The operation to optimize.
Class Method Summary collapse
-
.chain(*optimizers) ⇒ #call
Chain together a list of optimizer classes into a callable object.
Instance Method Summary collapse
-
#initialize(operation) ⇒ undefined
constructor
private
Initialize an Optimizer.
-
#optimizable? ⇒ Boolean
Abstract method that tests if the optimization should be applied.
-
#optimize ⇒ Optimizable
Abstract method that executes the optimization for the operation.
Constructor Details
#initialize(operation) ⇒ undefined
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.
Initialize an Optimizer
29 30 31 |
# File 'lib/veritas/optimizer.rb', line 29 def initialize(operation) @operation = operation end |
Instance Attribute Details
#operation ⇒ Optimizable (readonly)
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.
The operation to optimize
19 20 21 |
# File 'lib/veritas/optimizer.rb', line 19 def operation @operation end |
Class Method Details
.chain(*optimizers) ⇒ #call
Chain together a list of optimizer classes into a callable object
68 69 70 71 72 |
# File 'lib/veritas/optimizer.rb', line 68 def self.chain(*optimizers) optimizers.reverse_each.reduce(Noop) do |successor, optimizer| link_optimizers(optimizer, successor) end end |
Instance Method Details
#optimizable? ⇒ Boolean
Abstract method that tests if the optimization should be applied
41 42 43 |
# File 'lib/veritas/optimizer.rb', line 41 def optimizable? raise NotImplementedError, "#{self.class}#optimizable? must be implemented" end |
#optimize ⇒ Optimizable
Abstract method that executes the optimization for the operation
53 54 55 |
# File 'lib/veritas/optimizer.rb', line 53 def optimize raise NotImplementedError, "#{self.class}#optimize must be implemented" end |