Sha256: 1dbeb069a886e1f4cb23b4e7556d0d66edc5bd241db25d9af60278a755dc0ba5
Contents?: true
Size: 812 Bytes
Versions: 16
Compression:
Stored size: 812 Bytes
Contents
module Wukong module Streamer # # Roll up all records from a given key into a single list. # class ListReducer < Wukong::Streamer::AccumulatingReducer attr_accessor :values # start with an empty list def start! *args self.values = [] end # aggregate all records. # note that this accumulates the full *record* -- key, value, everything. def accumulate *record self.values << record end # emit the key and all records, tab-separated # # you will almost certainly want to override this method to do something # interesting with the values (or override accumulate to gather scalar # values) # def finalize yield [key, values.to_flat.join(";")].flatten end end end end
Version data entries
16 entries across 16 versions & 1 rubygems