Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 63D087C22 for ; Tue, 11 Oct 2011 02:10:59 +0000 (UTC) Received: (qmail 60990 invoked by uid 500); 11 Oct 2011 02:10:59 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 60942 invoked by uid 500); 11 Oct 2011 02:10:59 -0000 Mailing-List: contact commits-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 commits@hbase.apache.org Received: (qmail 60931 invoked by uid 99); 11 Oct 2011 02:10:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Oct 2011 02:10:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Oct 2011 02:10:57 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B04432388ADA for ; Tue, 11 Oct 2011 02:10:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1181461 - /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java Date: Tue, 11 Oct 2011 02:10:36 -0000 To: commits@hbase.apache.org From: nspiegelberg@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111011021036.B04432388ADA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nspiegelberg Date: Tue Oct 11 02:10:35 2011 New Revision: 1181461 URL: http://svn.apache.org/viewvc?rev=1181461&view=rev Log: Add ability to get Key-only information while scanning KVs in an HFile Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java?rev=1181461&r1=1181460&r2=1181461&view=diff ============================================================================== --- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java (original) +++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java Tue Oct 11 02:10:35 2011 @@ -1909,7 +1909,8 @@ public class HFile { CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(options, args); boolean verbose = cmd.hasOption("v"); - boolean printKeyValue = cmd.hasOption("p"); + boolean printValue = cmd.hasOption("p"); + boolean printKey = cmd.hasOption("pk") || printValue; boolean printMeta = cmd.hasOption("m"); boolean checkRow = cmd.hasOption("k"); boolean checkFamily = cmd.hasOption("a"); @@ -1955,7 +1956,7 @@ public class HFile { Map fileInfo = reader.loadFileInfo(); int count = 0; - if (verbose || printKeyValue || checkRow || checkFamily) { + if (verbose || printKey || checkRow || checkFamily) { // scan over file and read key/value's and check if requested HFileScanner scanner = reader.getScanner(false, false); scanner.seekTo(); @@ -1963,9 +1964,12 @@ public class HFile { do { KeyValue kv = scanner.getKeyValue(); // dump key value - if (printKeyValue) { - System.out.println("K: " + kv + - " V: " + Bytes.toStringBinary(kv.getValue())); + if (printKey) { + System.out.print("K: " + kv); + if (printValue) { + System.out.print(" V: " + Bytes.toStringBinary(kv.getValue())); + } + System.out.println(); } // check if rows are in order if (checkRow && pkv != null) { @@ -1996,7 +2000,7 @@ public class HFile { } while (scanner.next()); } - if (verbose || printKeyValue) { + if (verbose || printKey) { System.out.println("Scanned kv count -> " + count); }