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 92C8A10BCE for ; Fri, 4 Apr 2014 10:35:38 +0000 (UTC) Received: (qmail 72154 invoked by uid 500); 4 Apr 2014 10:35:35 -0000 Delivered-To: apmail-hbase-dev-archive@hbase.apache.org Received: (qmail 72054 invoked by uid 500); 4 Apr 2014 10:35:34 -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 72032 invoked by uid 99); 4 Apr 2014 10:35:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Apr 2014 10:35:32 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ramkrishna.s.vasudevan@gmail.com designates 209.85.192.175 as permitted sender) Received: from [209.85.192.175] (HELO mail-pd0-f175.google.com) (209.85.192.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Apr 2014 10:35:27 +0000 Received: by mail-pd0-f175.google.com with SMTP id x10so3148745pdj.34 for ; Fri, 04 Apr 2014 03:35:04 -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=ym7gdBoxMmT8O1rkR66NreaNVnQw/oCkW2ZNNxNdjDQ=; b=YfqhXr3CttCUlLtYgDaDUKgUntpeKTiY+IWLlO2nNgNm/T+V0qBh97HRMpHtqpG/o9 K8QCyhTG8sz/UvAMoD4nllNj2tqkV9YtS0lMjDLi3ZdRsa5E51qGrGJPTY8CdDh9MkzU 8+CyImyCWBnSg1psZkuQhSgBQhiQqpNsF/ZHn7AIFqXGyR7PlYztser26KnIrblvC5ot zn3RCyVTqapFeBPmm0MDwOB8F6Dnv8zSJ0NSgY2j/n8aEHFytzi2lSotsHXYz4/LzKsq JxXMAPItpcoEhsAXjfhzQoiOO7yAKkkj9rg4Oiz7k4flBGBGVbXOZ2v5Dsx1L6tp+Hln JnjA== MIME-Version: 1.0 X-Received: by 10.68.130.137 with SMTP id oe9mr13863029pbb.21.1396607704741; Fri, 04 Apr 2014 03:35:04 -0700 (PDT) Received: by 10.68.7.161 with HTTP; Fri, 4 Apr 2014 03:35:04 -0700 (PDT) In-Reply-To: <8E858C3A39F0D046B420FBA6F75448C02FA971F6@szxeml513-mbs.china.huawei.com> References: <8E858C3A39F0D046B420FBA6F75448C02FA97188@szxeml513-mbs.china.huawei.com> <8E858C3A39F0D046B420FBA6F75448C02FA971F6@szxeml513-mbs.china.huawei.com> Date: Fri, 4 Apr 2014 16:05:04 +0530 Message-ID: Subject: Re: Scan with SingleColumnValueFilterfilter giving wrong output From: ramkrishna vasudevan To: "dev@hbase.apache.org" Content-Type: multipart/alternative; boundary=047d7b15a9b121bce104f6351289 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b15a9b121bce104f6351289 Content-Type: text/plain; charset=ISO-8859-1 >>But for column value 'value1' also I am getting one row i.e., row1 with col1 You should get only one row ie. row1 with col1. Do you still get row6 for value1 even after setting filterIfMissing as true? Regards Ram On Fri, Apr 4, 2014 at 3:50 PM, ashish singhi wrote: > Hi Ram. > > Thanks for your time and explanation. > I tried by setting true to SingleColumnValueFilter.setFilterIfMissing as > you mentioned. > > It worked for column value 'value2' in output I got only row2 with col1. > But for column value 'value1' also I am getting one row i.e., row1 with > col1. As you said " In your first result row6 should not be the result > (strictly if you want only value1 with col1). You can see that it has col3 > in the result." > > But I want is to find all the columns in the table having mentioned column > value. Can someone please tell me how to get it ? > > -----Original Message----- > From: ramkrishna vasudevan [mailto:ramkrishna.s.vasudevan@gmail.com] > Sent: 04 April 2014 15:20 > To: dev@hbase.apache.org > Subject: Re: Scan with SingleColumnValueFilterfilter giving wrong output > > Hi Ashish > > I think the behaviour is fine. There is a property called filterIfMissing > in Single Columnvalue filter. If you don't need a row which does not have > the given column and value in your query, then you should set that to true. > See SingleColumnValueFilter.setFilterIfMissing. > In your first result row6 should not be the result (strictly if you want > only value1 with col1). You can see that it has col3 in the result. > > In your second result too row6 falls under the same category. > If a row has more than one cell and if we have found the matching cell, > the following cells of that row will also be included in the result. I > hope the same behavior is there in 0.94.11 also. (should be). > > Regards > Ram > > > > On Fri, Apr 4, 2014 at 2:37 PM, ashish singhi >wrote: > > > Hi all. > > > > I am using, > > HBase Version - 0.94.11 > > Hadoop Version - 2.1.0 > > > > I am trying to get columns having the specified value. So for that I > > am using org.apache.hadoop.hbase.filter.SingleColumnValueFilter class. > > But when I try to scan table to find columns with column value > > 'value2', I think I am not getting proper output. > > > > Can someone please tell me where I am wrong ? > > > > I have a simple hbase table with records. > > hbase(main):014:0> scan 'testTable' > > ROW COLUMN+CELL > > row1 > > column=colFammily1:col1, timestamp=1396586048561, value=value1 > > row2 > > column=colFammily1:col1, timestamp=1396586054526, value=value2 > > row2 > > column=colFammily1:col2, timestamp=1396585985022, value=testValue > > row3 > > column=colFammily1:col1, timestamp=1396586060989, value=value3 > > row4 > > column=colFammily1:col1, timestamp=1396586066037, value=value4 > > row5 > > column=colFammily1:col1, timestamp=1396586071842, value=value5 > > row6 > > column=colFammily1:col3, timestamp=1396590405939, value=value1 > > 6 row(s) in 0.0320 seconds > > > > First: When I executed scan command with column value 'value1' I got > > the proper output. > > hbase(main):023:0> scan 'testTable', {FILTER => > > org.apache.hadoop.hbase.filter.SingleColumnValueFilter.new(org.apache. > > hadoop.hbase.util.Bytes.toBytes('colFammily1'),org.apache.hadoop.hbase > > .util.Bytes.toBytes('col1'), > > > org.apache.hadoop.hbase.filter.CompareFilter::CompareOp.valueOf('EQUAL'),org.apache.hadoop.hbase.util.Bytes.toBytes('value1'))} > > ROW COLUMN+CELL > > row1 > > column=colFammily1:col1, timestamp=1396586048561, value=value1 > > row6 > > column=colFammily1:col3, timestamp=1396590405939, value=value1 > > 2 row(s) in 0.0160 seconds > > > > Second: When I tried same command with column value 'value2' the > > output seems to be incorrect. > > hbase(main):025:0> scan 'testTable', {FILTER => > > org.apache.hadoop.hbase.filter.SingleColumnValueFilter.new(org.apache. > > hadoop.hbase.util.Bytes.toBytes('colFammily1'),org.apache.hadoop.hbase > > .util.Bytes.toBytes('col1'), > > > org.apache.hadoop.hbase.filter.CompareFilter::CompareOp.valueOf('EQUAL'),org.apache.hadoop.hbase.util.Bytes.toBytes('value2'))} > > ROW COLUMN+CELL > > row2 > > column=colFammily1:col1, timestamp=1396586054526, value=value2 > > row2 > > column=colFammily1:col2, timestamp=1396585985022, value=testValue > > row6 > > column=colFammily1:col3, timestamp=1396590405939, value=value1 > > 2 row(s) in 0.0100 seconds > > > > I am not able to understand why I am getting row2 with col2 and row6 > > in the output where in their column values are not 'value2'. > > > > Regards, > > Ashish > > > --047d7b15a9b121bce104f6351289--