lib/veritas/optimizer/relation/operation/limit.rb in veritas-optimizer-0.0.5 vs lib/veritas/optimizer/relation/operation/limit.rb in veritas-optimizer-0.0.6
- old
+ new
@@ -35,11 +35,12 @@
#
# @return [Relation::Empty]
#
# @api private
def optimize
- Veritas::Relation::Empty.new(operation.header)
+ operation = self.operation
+ Veritas::Relation::Empty.new(operation.header, operation)
end
end # class ZeroLimit
# Optimize when the operand is a Limit and the limits are equal
@@ -92,11 +93,11 @@
#
# @return [Boolean]
#
# @api private
def optimize
- operation.class.new(operand.operand, min_limit)
+ operand.operand.take(min_limit)
end
private
# Return the minimum limit between the operation and operand
@@ -118,10 +119,10 @@
#
# @return [Limit]
#
# @api private
def optimize
- operation.class.new(operand, limit)
+ operand.take(limit)
end
end # class UnoptimizedOperand
Veritas::Relation::Operation::Limit.optimizer = chain(