module Bmg::Operator
Attributes
type[RW]
Public Instance Methods
_matching(type, right, on)
click to toggle source
# File lib/bmg/operator/allbut.rb, line 71 def _matching(type, right, on) # Always possible to push the matching, since by construction # `on` can only use attributes that have not been trown away, # hence they exist on `operand` too. operand.matching(right, on).allbut(butlist) end
_page(type, ordering, page_index, options)
click to toggle source
Calls superclass method
# File lib/bmg/operator/allbut.rb, line 78 def _page(type, ordering, page_index, options) return super unless self.preserving_key? operand.page(ordering, page_index, options).allbut(butlist) end
_project(type, attrlist)
click to toggle source
# File lib/bmg/operator/allbut.rb, line 83 def _project(type, attrlist) operand.project(attrlist) end
_restrict(type, predicate)
click to toggle source
# File lib/bmg/operator/allbut.rb, line 87 def _restrict(type, predicate) operand.restrict(predicate).allbut(butlist) end
_union(type, other, options)
click to toggle source
Calls superclass method
Bmg::Relation#_union
# File lib/bmg/operator/union.rb, line 73 def _union(type, other, options) return self if other.is_a?(Relation::Empty) norm_options = DEFAULT_OPTIONS.merge(options) return super unless norm_options == self.options case other when Union return super unless norm_options == other.send(:options) Union.new(type, operands + other.operands, options) else Union.new(type, operands + [other], options) end end
args()
click to toggle source
# File lib/bmg/operator/page.rb, line 52 def args [ ordering, page_index, options ] end
inspect()
click to toggle source
# File lib/bmg/operator.rb, line 18 def inspect str = "(#{self.class.name.split('::').last.downcase}\n" str << operands.map{|op| op.inspect.gsub(/^/m, " ") }.join("\n") str << "\n" str << args.map{|a| a.inspect.gsub(/^/m, " ") }.join("\n") str << ")" str end
jit_index_right()
click to toggle source
# File lib/bmg/operator/image.rb, line 128 def jit_index_right Image.new( type, left, right, as, on, options.merge(jit_optimized: true)) end
jit_refilter_right()
click to toggle source
# File lib/bmg/operator/image.rb, line 138 def jit_refilter_right ltc = left.type.predicate.constants rtc = right.type.predicate.constants jit_allbut, jit_on = on.partition{|attr| ltc.has_key?(attr) && rtc.has_key?(attr) && ltc[attr] == rtc[attr] } if jit_on.size == 1 p = Predicate.placeholder Image.new( type, left.materialize, right.restrict(Predicate.in(jit_on.first, p)).allbut(jit_allbut), as, jit_on, options.merge(jit_optimized: true, refilter_right: { placeholder: p })) else Image.new( type, left, right.allbut(jit_allbut), as, jit_on, options.merge(jit_optimized: true, strategy: :index_right)) end end
to_s()
click to toggle source
# File lib/bmg/operator.rb, line 9 def to_s str = "(#{self.class.name.split('::').last.downcase}\n" str << operands.map{|op| op.to_s.gsub(/^/m, " ") }.join("\n") str << "\n" str << args.map{|a| a.to_s.gsub(/^/m, " ") }.join("\n") str << ")" str end
Private Instance Methods
_unautowrap(operand, options)
click to toggle source
# File lib/bmg/operator/join.rb, line 73 def _unautowrap(operand, options) return [operand, false] unless operand.is_a?(Operator::Autowrap) return [operand, false] unless operand.same_options?(options) [operand.send(:operand), true] end