Sha256: ff8e6472e6acad5b9044b89d06fab2efe280881481a5752414b0641f5b1aedb1
Contents?: true
Size: 1.71 KB
Versions: 3
Compression:
Stored size: 1.71 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Optimizer::Algebra::Join::RightMaterializedOperand, '#optimizable?' do subject { object.optimizable? } let(:relation) { left.join(right) } let(:object) { described_class.new(relation) } before do object.operation.should be_kind_of(Algebra::Join) end context 'when the right is materialized and left is not a restriction' do let(:left) { Relation.new([ [ :id, Integer ], [ :name, String ] ], [ [ 1, 'Dan Kubb' ] ].each) } let(:right) { Relation.new([ [ :id, Integer ], [ :age, Integer ] ], [ [ 1, 35 ] ]) } it { should be(true) } end context 'when the right is materialized and left is a restriction not matching the right' do let(:left) { Relation.new([ [ :id, Integer ], [ :name, String ] ], [ [ 1, 'Dan Kubb' ] ].each).restrict { |r| r.name.eq('Dan Kubb') } } let(:right) { Relation.new([ [ :id, Integer ], [ :age, Integer ] ], [ [ 1, 35 ] ]) } it { should be(true) } end context 'when the right is materialized and left is a restriction matching the right' do let(:left) { Relation.new([ [ :id, Integer ], [ :name, String ] ], [ [ 1, 'Dan Kubb' ] ].each).restrict { |r| r.id.eq(1) } } let(:right) { Relation.new([ [ :id, Integer ], [ :age, Integer ] ], [ [ 1, 35 ] ]) } it { should be(false) } end context 'when the left is not materialized' do let(:left) { Relation.new([ [ :id, Integer ], [ :name, String ] ], [ [ 1, 'Dan Kubb' ] ].each) } let(:right) { Relation.new([ [ :id, Integer ], [ :age, Integer ] ], [ [ 1, 35 ] ].each) } it { should be(false) } end end
Version data entries
3 entries across 3 versions & 1 rubygems