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 1DA2910207 for ; Thu, 20 Jun 2013 04:09:26 +0000 (UTC) Received: (qmail 42845 invoked by uid 500); 20 Jun 2013 04:09:23 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 42796 invoked by uid 500); 20 Jun 2013 04:09:23 -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 42787 invoked by uid 99); 20 Jun 2013 04:09:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jun 2013 04:09:23 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rohitkelkar@gmail.com designates 209.85.223.177 as permitted sender) Received: from [209.85.223.177] (HELO mail-ie0-f177.google.com) (209.85.223.177) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jun 2013 04:09:18 +0000 Received: by mail-ie0-f177.google.com with SMTP id aq17so14107561iec.8 for ; Wed, 19 Jun 2013 21:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=j4LcUSA1SAsS+xmnnCR0ZyKQwws8qVRPzQhci328w/k=; b=XsK0TSfB6si6aKmMycqUbHhPVLsKpChLr/TTku1OOcJ4vh6jUVQA5KZFVKljTWCPul ICO1nlI0sMc5uWd+VSzS7QtYqeanaaZabcblCL6tIKLfOeWyvEWr/nLt9NRESDy0Kg+i VjNIIGCdNBcesgstthxwi9VD1i9heJsiz4HNtsEd0hEnimixQw0uB19Fpc9llErq6p3c sxbLCJwORM+/HDVcByFuuGytyEeYsIGbnifNWv8oG1cqRAg9eEaRjB6DVntc+AsOuJiT uku6tHoRrsfaN3BUObhvb+4V2GmrdJJeIwtmtyC1VZcfIQ6IRoLfA3CvoBqf8yXuBRFc JLvQ== MIME-Version: 1.0 X-Received: by 10.50.16.99 with SMTP id f3mr2546498igd.13.1371701338495; Wed, 19 Jun 2013 21:08:58 -0700 (PDT) Received: by 10.42.102.200 with HTTP; Wed, 19 Jun 2013 21:08:58 -0700 (PDT) In-Reply-To: References: Date: Wed, 19 Jun 2013 23:08:58 -0500 Message-ID: Subject: Re: Problem with HFile lexical comparison From: Rohit Kelkar To: user@hbase.apache.org Content-Type: multipart/alternative; boundary=047d7bdc150a04ebd404df8e1b65 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bdc150a04ebd404df8e1b65 Content-Type: text/plain; charset=ISO-8859-1 Perfect. That worked. Thanks. - R On Wed, Jun 19, 2013 at 7:23 PM, Jeff Kolesky wrote: > Last time I wrote directly to an HFile, I instantiated an HFile.Writer > using this statement: > > HFile.Writer writer = HFile.getWriterFactory(config) > .createWriter(fs, hfilePath, > (bytesPerBlock * 1024), > Compression.Algorithm.GZ, > KeyValue.KEY_COMPARATOR); > > Perhaps you need the declaration of the comparator in the create statement > for the writer. > > Jeff > > > > On Wed, Jun 19, 2013 at 5:11 PM, Rohit Kelkar > wrote: > > > Thanks for the replies, I tried the KeyValue.KVComparator but still no > > luck. So I commented the comparator and played around with the sequence > of > > writing the qualifiers to the HFile. (see code here: > > https://gist.github.com/anonymous/5819254) > > > > If I set the variable String[] starr = new String[]{"a", "d", "dt", > "dth"} > > then the code breaks while writing the qualifier "dt" to the HFile. > > If I set the variable String[] starr = new String[]{"a", "dth", "dt", > "d"} > > then the code runs successfully. > > If I set the variable String[] starr = new String[]{"dth", "dt", "d", > "a"} > > then the code breaks while writing "a" to the HFile > > > > Does this mean that if the qualifiers start with the same character then > > the longest qualifier should be written first? Else the usual lexical > order > > is honoured? > > > > The code throws following stack trace > > Added a key not lexically larger than previous > > > > > key=\x00\x1B10011-2-0000000000000000703\x02sddt\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x04, > > > > > lastkey=\x00\x1B10011-2-0000000000000000703\x02sdd\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x04 > > at > > > > > org.apache.hadoop.hbase.io.hfile.AbstractHFileWriter.checkKey(AbstractHFileWriter.java:207) > > at > > > > > org.apache.hadoop.hbase.io.hfile.HFileWriterV2.append(HFileWriterV2.java:317) > > at > > > > > org.apache.hadoop.hbase.io.hfile.HFileWriterV2.append(HFileWriterV2.java:282) > > at com.mycompany.hbase.process.myprocess.myFunction(MyClass.java:1492) > > > > I am using hbase-0.94.2 > > > > - Rohit Kelkar > > > > > > On Wed, Jun 19, 2013 at 1:15 PM, Jeff Kolesky wrote: > > > > > I believe you need to use the KVComparator: > > > > > > > > > > > > https://github.com/apache/hbase/blob/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java#L88 > > > > > > Jeff > > > > > > > > > On Wed, Jun 19, 2013 at 10:32 AM, Rohit Kelkar > > >wrote: > > > > > > > Here is the code - https://gist.github.com/anonymous/5816180 > > > > > > > > I guess the issue is with my use of the comparator function. > > > > > > > > - R > > > > > > > > > > > > > > > > -- > > > *Jeff Kolesky* > > > Chief Software Architect > > > *Opower* > > > > > > > > > -- > *Jeff Kolesky* > Chief Software Architect > *Opower* > --047d7bdc150a04ebd404df8e1b65--