CS157b
Chris Pollett
Apr 26, 2023
/* imagine k is a document key (for example a URL or a table ID), v is a document (such as a web page, or a text column of a table) */ map(k, v) split v into tokens for each token t do output (t, 1) return
reduce (k, [v[1], v[2], ..., v[n]]) count := 0 for i := 1 to n do count += v //v might be not 1 depending on MR optimization in use output (count) return