Return-Path: X-Original-To: apmail-hbase-dev-archive@www.apache.org Delivered-To: apmail-hbase-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5AF7EC435 for ; Mon, 3 Jun 2013 02:01:26 +0000 (UTC) Received: (qmail 93809 invoked by uid 500); 3 Jun 2013 02:01:25 -0000 Delivered-To: apmail-hbase-dev-archive@hbase.apache.org Received: (qmail 93754 invoked by uid 500); 3 Jun 2013 02:01:25 -0000 Mailing-List: contact dev-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list dev@hbase.apache.org Received: (qmail 93746 invoked by uid 99); 3 Jun 2013 02:01:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 02:01:25 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of nidmgg@gmail.com designates 209.85.216.179 as permitted sender) Received: from [209.85.216.179] (HELO mail-qc0-f179.google.com) (209.85.216.179) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 02:01:19 +0000 Received: by mail-qc0-f179.google.com with SMTP id e1so1851422qcx.24 for ; Sun, 02 Jun 2013 19:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:references:from:content-type:x-mailer:in-reply-to :message-id:date:to:content-transfer-encoding:mime-version; bh=L1IuTzUdvIacDalJs8sOr/Sfj6j4NmmRp3MBWIK68h8=; b=rg3pUnWK8JPerVAjOTDkISG/Toj9NP0A0+d5lgH4OODUBazkUg1lTCqb4lhOe5+KT8 fFGY8XXB41QwhLPvXMJup+TQN1bZnf9GOjLtTRj5pjtEv/WyWyx3EPnKmNBKMLMbHRhn Pxc/fB3w3hT3cuQ1u3acQoQ3KDqiWqHIft+TvVm6MjgVZ6eXsxxXhES5Vh/Risv6miLt yEmDZjtJKzrFlONGx6k78hSv9BEZDOUdIJwbbB3fNgQKANotfltD5Y4HBjY95NU9R5Up GBO/XU4mc8W2KA0Rt73wkhmNdrEMDbGVT+6MYx+hALvde8rCTikXcDyjY8UTc1eLbIzG QbCw== X-Received: by 10.224.47.6 with SMTP id l6mr17326571qaf.9.1370224858665; Sun, 02 Jun 2013 19:00:58 -0700 (PDT) Received: from [192.168.200.33] (108-93-45-82.lightspeed.sntcca.sbcglobal.net. [108.93.45.82]) by mx.google.com with ESMTPSA id v1sm58672170qab.8.2013.06.02.19.00.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 02 Jun 2013 19:00:58 -0700 (PDT) Subject: Re: how to use HBase Shell formatter? References: From: Demai Ni Content-Type: text/plain; charset=us-ascii X-Mailer: iPhone Mail (9B176) In-Reply-To: Message-Id: Date: Sun, 2 Jun 2013 19:00:55 -0700 To: "dev@hbase.apache.org" Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (1.0) X-Virus-Checked: Checked by ClamAV on apache.org Ted, Thanks for pointing me the direction. I will looking into the enhancement Demai on the run On Jun 2, 2013, at 1:43 PM, Ted Yu wrote: > Looking at the following from formatter.rb: > col1width = (not widths or widths.length == 0) ? @max_width / 4 > : @max_width * widths[0] / 100 > col2width = (not widths or widths.length < 2) ? @max_width - > col1width - 2 : @max_width * widths[1] / 100 - 2 > > It seems the widths argument only expects two fields which should be > percentage of widths for columns 1 and 2, respectively. > > If you want 3 columns to be displayed, you should enhance formatter.rb > > Cheers > > On Sun, Jun 2, 2013 at 10:30 AM, N Dm wrote: > >> 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 >>