Sha256: 1118d95d7e725778bcb4ade0d13d2bba919455e99b19b58c168b3d21455460bd

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Algebra::Summarization::UnoptimizedOperand, '#optimize' do
  subject { object.optimize }

  let(:header)        { Relation::Header.new([ [ :id, Integer ] ])                          }
  let(:base)          { Relation.new(header, [ [ 1 ] ].each)                                }
  let(:attribute)     { Attribute::Object.new(:text)                                        }
  let(:function)      { Aggregate::Sum.new(Function::Numeric::Absolute.new(1))              }
  let(:operand)       { base.rename({})                                                     }
  let(:summarize_per) { TABLE_DEE.project([])                                               }
  let(:relation)      { operand.summarize(summarize_per) { |r| r.add(attribute, function) } }
  let(:object)        { described_class.new(relation)                                       }

  before do
    object.should be_optimizable
  end

  it { should be_kind_of(Algebra::Summarization) }

  it { should_not equal(operand) }

  its(:operand) { should equal(base) }

  its(:summarize_per) { should equal(TABLE_DEE) }

  its(:summarizers) { pending { should == { attribute => Aggregate::Sum.new(1) } } }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/algebra/summarization/unoptimized_operand/optimize_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/algebra/summarization/unoptimized_operand/optimize_spec.rb