Sha256: d466ef92fc73956e03ddc126c284626e16597cad7ab036e6b1087f0b879a3c9d
Contents?: true
Size: 488 Bytes
Versions: 10
Compression:
Stored size: 488 Bytes
Contents
module Wukong module Streamer # # Count the number of records for each key. # class CountingReducer < AccumulatingReducer attr_accessor :count # start the sum with 0 for each key def start! *_ self.count = 0 end # ... and count the number of records for this key def accumulate *_ self.count += 1 end # emit [key, count] def finalize yield [key, count].flatten end end end end
Version data entries
10 entries across 10 versions & 1 rubygems