Class: Bud::Agg

Inherits:
Object
  • Object
show all
Defined in:
lib/bud/aggs.rb

Overview

Agg definitions

Direct Known Subclasses

Accum, AccumPair, ArgExemplary, Avg, Count, Sum

Instance Method Summary collapse

Instance Method Details

#final(the_state) ⇒ Object



20
21
22
# File 'lib/bud/aggs.rb', line 20

def final(the_state)
  the_state
end

#init(val) ⇒ Object

:nodoc: all



4
5
6
# File 'lib/bud/aggs.rb', line 4

def init(val)
  val
end

#trans(the_state, val) ⇒ Object

In order to support argagg, trans must return a pair:

1. the running aggregate state
2. a flag to indicate what the caller should do with the input tuple for argaggs
   a. :ignore tells the caller to ignore this input
   b. :keep tells the caller to save this input
   c. :replace tells the caller to keep this input alone
   d. :delete, [t1, t2, ...] tells the caller to delete the remaining tuples
For aggs that do not inherit from ArgExemplary, the 2nd part can simply be nil.


16
17
18
# File 'lib/bud/aggs.rb', line 16

def trans(the_state, val)
  return the_state, :ignore
end