Created
June 21, 2012 13:50
-
-
Save simonholgate/2965839 to your computer and use it in GitHub Desktop.
Cascalog test with HBase
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
(ns test.hbase | |
(:require (cascalog [workflow :as w] | |
[ops :as c] | |
[vars :as v])) | |
(:import (org.apache.hadoop.hbase.util Bytes) | |
(com.twitter.maple.hbase HBaseTap HBaseScheme) | |
(cascading.hbase ByteHolder))) | |
(use '[cascalog api playground]) | |
(bootstrap-emacs) | |
(defn hbase-tap [table-name key-field column-family & value-fields] | |
(let [scheme (HBaseScheme. (w/fields key-field) column-family (w/fields value-fi\ | |
elds))] | |
(HBaseTap. table-name scheme))) | |
(defn as-string [^ByteHolder bytes] | |
(.toString bytes)) | |
(let [age-table (hbase-tap "age-table" "?person" "cf" "?age")] | |
(?<- (stdout) [?p ?a] (age-table ?p ?age) (as-string ?age :> ?a))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment