Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 108FDD4F8 for ; Thu, 20 Dec 2012 20:07:57 +0000 (UTC) Received: (qmail 37732 invoked by uid 500); 20 Dec 2012 20:07:55 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 37678 invoked by uid 500); 20 Dec 2012 20:07:55 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 37667 invoked by uid 99); 20 Dec 2012 20:07:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Dec 2012 20:07:55 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of amp@opendns.com designates 67.215.92.38 as permitted sender) Received: from [67.215.92.38] (HELO mail.opendns.com) (67.215.92.38) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Dec 2012 20:07:47 +0000 Received: from adams-desktop.ad.office.opendns.com ([67.215.87.16]) (authenticated bits=0) by mail.opendns.com (8.14.3/8.14.3/Debian-9.4) with ESMTP id qBKK7PdO007112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 20 Dec 2012 20:07:25 GMT X-DKIM: Sendmail DKIM Filter v2.8.2 mail.opendns.com qBKK7PdO007112 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=opendns.com; s=mail; t=1356034045; bh=j4vLk6DMBacs5h1QSiKRM5GUU5PxkDNedPGSs0ZAmsg=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=SbsKqL2PoSduVfXGZ+/dGh3rwmrwpNUMmbmWeixF09Rd/OWq0R+787l86tXdqfmRw zQzApNo3fcGLo6BbNHOYgQNJyPLk6HZvVIbmJGTIcYp6dQdV2SrA8u4lKfEHyx5+Ap GPooWySe47lnM8wFCi2uJxbKJ1ljtSFAMGHj/aow= Message-ID: <50D36FF8.6060400@opendns.com> Date: Thu, 20 Dec 2012 12:07:20 -0800 From: Adam Phelps User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: user@hbase.apache.org Subject: Re: Customizing hbase shell's table formatting References: <50D21009.5060008@opendns.com> In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.2 at mail.opendns.com X-Virus-Status: Clean X-Virus-Checked: Checked by ClamAV on apache.org Thanks for the info. I see that info now that I look at the current version's scan command, its just not in the 0.90.6 we're currently on but should be updating before long. This sounds like the formatting is for column only, our rowkeys themselves are serialized, is there no way to specify a formatter for the keys? - Adam On 12/19/12 1:17 PM, Stack wrote: > In trunk, scan and get have formatting options. If you do help 'scan', in > the middle you should see: > > "...Besides the default 'toStringBinary' format, 'scan' supports custom > formatting > by column. A user can define a FORMATTER by adding it to the column name in > the scan specification. The FORMATTER can be stipulated: > > 1. either as a org.apache.hadoop.hbase.util.Bytes method name (e.g, toInt, > toString) > 2. or as a custom class followed by method name: e.g. > 'c(MyFormatterClass).format'. > > Example formatting cf:qualifier1 and cf:qualifier2 both as Integers: > hbase> scan 't1', {COLUMNS => ['cf:qualifier1:toInt', > 'cf:qualifier2:c(org.apache.hadoop.hbase.util.Bytes).toInt'] } > > Note that you can specify a FORMATTER by column only (cf:qualifer). You > cannot > specify a FORMATTER for all columns of a column family...." > > Also, if you look in src, you fill > find hbase-server/src/main/ruby/shell/formatter.rb. > > Check it out. See how there are a few formatters therein. Formatters are > responsible for outputting results. > > There is a the base abstract class and then a Console and unimplemented > xhtml and json formatters. > > You used to be able to specify an alternate 'formatter' to use on the > commmand line. > > durruti:hbase stack$ ./bin/hbase shell --help > Usage: shell [OPTIONS] [SCRIPTFILE [ARGUMENTS]] > > --format=OPTION Formatter for outputting results. > Valid options are: console, html. > (Default: console) > > -d | --debug Set DEBUG log levels. > -h | --help This help. > > My guess is this facility has rotted from lack of use but if you wanted to > hook it all up again, the ghosts of an alternate formatter might guide you > some. > > Good luck, > St.Ack > > > On Wed, Dec 19, 2012 at 11:05 AM, Adam Phelps wrote: > >> Is there a reasonably straight forward way to customize the shell's >> output for a given table? While many of our tables use string based >> data, we have some that use serialized data which is useless to view >> directly in the shell on the occasions where it'd be useful for >> debugging the output of a M/R job. >> >> I'd think there'd be a way to write a object to serialize and >> deserialize the keys and values that could be plugged into the shell, >> but I'm not quickly finding how I'd do that. >> >> (Note - I know almost nothing about ruby so I could easily be >> overlooking something). >> >> - Adam >> >