hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From N Dm <nid...@gmail.com>
Subject how to use HBase Shell formatter?
Date Sun, 02 Jun 2013 17:30:04 GMT
hi, folks,

Can someone point me to a sample about how to use 'formatter.rb' inside
hbase ruby code? The version I am using is 94.3

I am trying to implement a 'list_replicated_table' command on hbase shell,
and leveraging 'formatter" to lay out the output. The code segement is
like:

        formatter.header(["TABLE","COLUMNFAMILY", "TARGET_CLUSTER"])
        ......
        list.each do |e|
          formatter.row([e[0],e[1],e[2]])
        end
        .....
        formatter.footer(now)

where e[0],e[1], and e[2] are entries from a String array. I was hoping to
have a nice output with column aligned. However, I got the output with a
blank as delimiter.
hbase(main):002:0> list_replicated_tables
 TABLE COLUMNFAMILY TARGET_CLUSTER
 scores course hdtest017.svl.ibm.com:2181:/hbase
 t3_dn cf1 hdtest017.svl.ibm.com:2181:/hbase
 usertable family hdtest017.svl.ibm.com:2181:/hbase

I am looking for something like:
TABLE          COLUMNFAMILY  TARGET_CLUSTER
scores         course        hdtest017.svl.ibm.com:2181:/hbase

I was following the way 'list_peers' did, seems don't work over there
either.

I also changed the formatter input as:
formatter.header(["TABLE","COLUMNFAMILY", "TARGET_CLUSTER"],[18,18,48])
formatter.row([e[0],e[1],e[2]],true,[18,18,48])
which doesn't change the output either.


The 'scan.rb' works fine, however, I can't tell what's the differnce.

Any suggestion is really appreciated. Thanks!

Demai

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message