Created
September 15, 2010 07:42
-
-
Save tfoldi/580381 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%YAML 1.1 | |
--- | |
VERSION: 1.0.0.1 | |
DEFINE: | |
- INPUT: | |
NAME: book | |
FILE: | |
# change seghostname and file_path to reflect your | |
# runtime file location | |
- localhost.localdomain:/home/gpadmin/gpmrdata/whitepaper.txt | |
- MAP: | |
NAME: wordsplit_ruby | |
FUNCTION: | | |
h = {} | |
value.split.each { |w| | |
if h.has_key?(w) | |
h[w] = h[w] + 1 | |
else | |
h[w] = 1 | |
end | |
} | |
h.each_pair {|k,v| yield [k,v]} | |
return | |
LANGUAGE: ruby | |
OPTIMIZE: STRICT IMMUTABLE | |
PARAMETERS: value text | |
RETURNS: | |
- key text | |
- value integer | |
EXECUTE: | |
- RUN: | |
SOURCE: book | |
MAP: wordsplit_ruby | |
REDUCE: SUM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment