Skip to content

Instantly share code, notes, and snippets.

@tfoldi
Created September 15, 2010 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfoldi/580381 to your computer and use it in GitHub Desktop.
Save tfoldi/580381 to your computer and use it in GitHub Desktop.
%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