Use cascading/maple to query hbase by specifying the row-id

58 views
Skip to first unread message

Pranav

unread,
Jul 11, 2012, 5:23:33 AM7/11/12
to cascadi...@googlegroups.com
I am using the cascading/maple tap for hbase and I want to query by specifying the row-id. 

(defn hbase-tap [table-name key-field column-family & value-fields]
  (let [scheme (HBaseScheme. (w/fields key-field) column-family (w/fields value-fields))
        tap (HBaseTap. table-name scheme)]
    tap))

(defn to-string [bytes]
  (if (= nil bytes)
    ""
    (String. bytes)))

(defn trial-query
  []
  (let [h-table (hbase-tap "test" "row1" "cf" "a")]
    (?<- (stdout)
         [!l !l1]
         (h-table !name !temp)
         (to-string !name :> !l)
         (to-string !temp :> !l1))))

This query returns all rows which have columns 'cf:a'. I want cf:a only from row-id 'row1'. 
Could someone point to examples that accomplish this? Java examples are fine too. Thanks!

Pranav

unread,
Jul 17, 2012, 2:33:54 AM7/17/12
to cascadi...@googlegroups.com
bump. Alternatively, a way to get all columns from a column family for a row-id or even all data(all column families) for a row-id would be good.  

I tried using Fields/ALL to create the hbase tap like this - 

(HBaseScheme. (w/fields key-field) column-family Fields/ALL)

But this gives this error - 

cannot join fields if one is a substitution or is unknown
  [Thrown class cascading.tuple.TupleException]

Is there a way to do this? 
Reply all
Reply to author
Forward
0 new messages