Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> Get all rows that DON'T have certain qualifiers


Copy link to this message
-
Re: Get all rows that DON'T have certain qualifiers
Hi Amit,
Using Phoenix, the SQL skin over HBase (https://github.com/forcedotcom/phoenix), you'd do this:

select * from myTable where value1 is null or value2 is null

Regards,
James
http://phoenix-hbase.blogspot.com
@JamesPlusPlus

On May 14, 2013, at 6:56 AM, "samar.opensource" <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I will try to write a sample code and execute it , but what i gather
> from the blog and the java apidoc is that u just need to do opposite of
> what u r doing .
>
> so use
> CompareOp.|*EQUAL
> <http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/filter/CompareFilter.CompareOp.html#EQUAL>*|
> and then put a value so that it never occurs in you column ( this will
> filter out all the rows for which the column qualifier exists )
>
> secondly
>
> filter1.setFilterIfMissing(false)
> since : If false, the row will pass if the column is not found. This is
> default. (taken from apidoc)
>
>  This way you should be able to get all the rows that don have the
> certain qualifier.
>
> Regards,
> Samar
>
> On 08/05/13 8:17 PM, Ted Yu wrote:
>> I think you can implement your own filter that overrides this method:
>>
>>   public void filterRow(List<KeyValue> ignored) throws IOException {
>> When certain qualifiers don't appear in the List, you can remove all the
>> kvs from the passed List.
>>
>> Cheers
>>
>> On Wed, May 8, 2013 at 7:00 AM, Amit Sela <[EMAIL PROTECTED]> wrote:
>>
>>> Forgot to mention: Hadoop 1.0.4 & HBase 0.94.2
>>>
>>>
>>> On Wed, May 8, 2013 at 4:52 PM, Amit Sela <[EMAIL PROTECTED]> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I'm trying to scan my HBase table to get only rows that are missing some
>>>> qualifiers.
>>>>
>>>> I read that for getting rows with specific qualifiers I should use
>>>> something like:
>>>>
>>>> List list = new ArrayList<Filter>(2);
>>>> Filter filter1 = new SingleColumnValueFilter(Bytes.toBytes("fam1"),
>>>>  Bytes.toBytes("VALUE1"), CompareOp.DOES_NOT_EQUAL,
>>>> Bytes.toBytes("DOESNOTEXIST"));
>>>> filter1.setFilterIfMissing(true);
>>>> list.addFilter(filter1);
>>>> Filter filter2 = new SingleColumnValueFilter(Bytes.toBytes("fam2"),
>>>>  Bytes.toBytes("VALUE2"), CompareOp.DOES_NOT_EQUAL,
>>>> Bytes.toBytes("DOESNOTEXIST"));
>>>> filter2.setFilterIfMissing(true);
>>>> list.addFilter(filter2);
>>>> FilterList filterList = new FilterList(list);
>>>> Scan scan = new Scan();
>>>> scan.setFilter(filterList);
>>>>
>>>> (I found this here:
>>>>
>>> http://mapredit.blogspot.co.il/2012/05/using-filters-in-hbase-to-match-two.html
>>>> )
>>>> And it works just fine.
>>>>
>>>> So as I thought that if I use SkipFilter(FilterList) I'll skip the rows
>>>> returned by the filter list >> causing a sort of NOT and getting all rows
>>>> that don't have any of theses qualifiers.
>>>>
>>>> This doesn't seem to work... Anyone has a good suggestion how to get rows
>>>> that are missing specific qualifiers ? Any idea why SkipFilter fails ?
>>>>
>>>> Thanks,
>>>>
>>>> Amit
>>>>
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB