-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ji Zhang
committed
Feb 12, 2013
1 parent
2a6e929
commit 1ffff9d
Showing
7 changed files
with
44 additions
and
67 deletions.
There are no files selected for viewing
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
(ns cia-hadoop.wordcount | ||
(:require [clojure-hadoop.wrap :as wrap] | ||
[clojure-hadoop.defjob :as defjob]) | ||
(:import [java.util StringTokenizer]) | ||
(:use clojure-hadoop.job)) | ||
|
||
(defn my-map [key value] | ||
(map (fn [token] [token 1]) | ||
(enumeration-seq (StringTokenizer. value)))) | ||
|
||
(defn my-reduce [key values-fn] | ||
[[key (reduce + (values-fn))]]) | ||
|
||
(defjob/defjob job | ||
:map my-map | ||
:map-reader wrap/int-string-map-reader | ||
:reduce my-reduce | ||
:input-format :text | ||
:output-format :text | ||
:compress-output false | ||
:replace true | ||
:input "README.md" | ||
:output "out-wordcount") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(ns cia-hadoop.wordcount-test | ||
(:use clojure.test | ||
clojure-hadoop.job | ||
cia-hadoop.wordcount)) | ||
|
||
(deftest test-wordcount | ||
(is (run job))) |