aboutsummaryrefslogtreecommitdiffstats
path: root/pig/hbase-count-rows.pig
diff options
context:
space:
mode:
Diffstat (limited to 'pig/hbase-count-rows.pig')
-rw-r--r--pig/hbase-count-rows.pig15
1 files changed, 15 insertions, 0 deletions
diff --git a/pig/hbase-count-rows.pig b/pig/hbase-count-rows.pig
new file mode 100644
index 0000000..57e83a5
--- /dev/null
+++ b/pig/hbase-count-rows.pig
@@ -0,0 +1,15 @@
+
+REGISTER /usr/lib/hbase/lib/hbase-client-0.98.6-cdh5.3.1.jar
+REGISTER /usr/lib/hbase/lib/hbase-common-0.98.6-cdh5.3.1.jar
+REGISTER /usr/lib/hbase/lib/hbase-hadoop2-compat-0.98.6-cdh5.3.1.jar
+REGISTER /usr/lib/hbase/lib/hbase-protocol-0.98.6-cdh5.3.1.jar
+
+set hbase.zookeeper.quorum 'mtrcs-zk1.us.archive.org,mtrcs-zk2.us.archive.org,mtrcs-zk3.us.archive.org'
+
+data = LOAD 'hbase://wbgrp-journal-extract-0-qa'
+ USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('grobid0:status_code', '-loadKey true')
+ AS (key:CHARARRAY, status:CHARARRAY);
+
+data_group = GROUP data ALL;
+data_count = FOREACH data_group GENERATE COUNT(data);
+DUMP data_count;