hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jian Lu <...@local.com>
Subject RE: Server side filters
Date Wed, 15 Sep 2010 16:31:12 GMT
Hi Jilil,

I am new to HBase. I used filters on three different columns on a single table, as shown below.
 The three filters are AND-ed together (must pass all).  It works well for me.  Not sure it
would help you or not.


FilterList filterList = new FilterList();
		    if (minClickCount != null) {
		    	BinaryComparator bComparater = new BinaryComparator(Bytes.toBytes(String.valueOf(minClickCount)));
	    				 	  		SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes.toBytes(Constants.IMPRESSION_SUMMARY_COLUMN_FAMILY),
	    				Bytes.toBytes(Constants.IMPRESSION_SUMMARY_CLICK_COUNT), CompareFilter.CompareOp.GREATER_OR_EQUAL,
bComparater);
	    		filter.setFilterIfMissing(true);
	    		filterList.addFilter(filter);
		    }
		    
		    
		    if (minCTR != null) {
		    	BinaryComparator bComparater = new BinaryComparator(Bytes.toBytes(String.valueOf(minCTR)));
 
		    	SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes.toBytes(Constants.IMPRESSION_SUMMARY_COLUMN_FAMILY),
	    				Bytes.toBytes(Constants.IMPRESSION_SUMMARY_CLICK_THROUGH_RATE), CompareFilter.CompareOp.GREATER_OR_EQUAL,
bComparater);
	    		filter.setFilterIfMissing(true);
	    		filterList.addFilter(filter);		    	
		    }
		    
		    if (proID != null) {
		    	
		    	SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes.toBytes(Constants.IMPRESSION_SUMMARY_COLUMN_FAMILY),
    			Bytes.toBytes(Constants.IMPRESSION_SUMMARY_PRO_ID), CompareFilter.CompareOp.EQUAL,
Bytes.toBytes(proID));
		    	filter.setFilterIfMissing(true);
		    	filterList.addFilter(filter);		    		    	    		    	
		    }
		    
		    scan.setFilter(filterList);



Jack.

-----Original Message-----
From: acc2@jalilweb.com [mailto:acc2@jalilweb.com] 
Sent: Wednesday, September 15, 2010 6:19 AM
To: user@hbase.apache.org
Subject: Server side filters

Hello all,

I am trying to use HBase for a project. The data base will hold
billions of rows.

I am struggling to understand how filters work. In particular, I want
to be able to scan for rows that contain all of these columns for
example:

numbers:three  & numbers:five  & numbers:seven

I tried to set a FilterList with MustMatchAll operator and with a
QualifierFilter for each of the colum qualifiers I am looking for.

The problem is that the scanner returns no results if I set the
filters as above.

Is there a way to get only the rows that contain a set of column
qualifiers? server-side.

I know how to do it client side, by iterating through the results, but
I don't want my client to iterate through a billion rows. It wouldn't
make sense.

Many thanks,

Jalil



----- End forwarded message -----



Mime
View raw message