hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Hadoop Wiki] Trivial Update of "Hbase/Jython" by stack
Date Tue, 18 Mar 2008 19:32:16 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.

The following page has been changed by stack:
http://wiki.apache.org/hadoop/Hbase/Jython

The comment on the change is:
Added another jython example

------------------------------------------------------------------------------
  
  }}}
  
+ == Another Sample ==
+ {{{# Print all rows that are members of a particular column family
+ # by passing a regex for family qualifier (HQL does not support
+ #
+ # To run this script, I did the following:
+ 
+ # $ HBASE_OPTS="-Dpython.path=$JYTHON_HOME" HBASE_CLASSPATH=$JYTHON_HOME/jython.jar ./bin/hbase
org.python.util.jython select.jython
+ #
+ from org.apache.hadoop.hbase import HBaseConfiguration, HTable, HStoreKey
+ from org.apache.hadoop.io import Text
+ from java.util import TreeMap
+ from jarray import array
+ 
+ c = HBaseConfiguration()
+ t = HTable(c, Text("enwiki_080103"))
+ b = Text("title:.*$")
+ columns = array([a], Text)
+ scanner = t.obtainScanner(columns, Text(""))
+ key = HStoreKey()
+ value = TreeMap()
+ while 1:
+     result = scanner.next(key, value)
+     if not result:
+         break
+     print key}}}
+ 

Mime
View raw message