diff options
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r-- | lib/arel/algebra/relations/operations/group.rb | 4 | ||||
-rw-r--r-- | lib/arel/algebra/relations/operations/join.rb | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/arel/algebra/relations/operations/group.rb b/lib/arel/algebra/relations/operations/group.rb index 68c626e917..af0d3c6808 100644 --- a/lib/arel/algebra/relations/operations/group.rb +++ b/lib/arel/algebra/relations/operations/group.rb @@ -14,5 +14,9 @@ module Arel @relation == other.relation && @groupings == other.groupings end + + def eval + raise NotImplementedError + end end end diff --git a/lib/arel/algebra/relations/operations/join.rb b/lib/arel/algebra/relations/operations/join.rb index 9eee84113a..5d19873f62 100644 --- a/lib/arel/algebra/relations/operations/join.rb +++ b/lib/arel/algebra/relations/operations/join.rb @@ -53,6 +53,19 @@ module Arel # FIXME remove this. :'( alias :eql? :== + + def eval + result = [] + relation1.call.each do |row1| + relation2.call.each do |row2| + combined_row = row1.combine(row2, self) + if predicates.all? { |p| p.eval(combined_row) } + result << combined_row + end + end + end + result + end end class InnerJoin < Join; end |