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 Plain View
HBase >> mail # user >> Scan.addFamiliy reduces results


+
Peter Wolf 2012-03-15, 16:08
Copy link to this message
-
Re: Scan.addFamiliy reduces results

On Mar 15, 2012, at 17:08 , Peter Wolf wrote:

> Hi all,
>
> I am doing a scan on a table with multiple families.  My code looks like
> this...
>
>         Scan scan = new Scan(calculateStartRowKey(a),
> calculateEndRowKey(b));
>
>         scan.setCaching(10000);
>         Filter filter = new SingleColumnValueFilter(xFamily, xColumn,
> CompareFilter.CompareOp.EQUAL, Bytes.toBytes(x));

>From SingleColumnValueFilter documentation ( http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/filter/SingleColumnValueFilter.html )
When using this filter on a Scan with specified inputs, the column to be tested should also be added as input (otherwise the filter will regard the column as missing).

I understand that you have to add xFamily, so your example below with the commented out addFamily(xFamily) would be wrong.
>         scan.setFilter(filter);
>         scan
>                 .addFamily(xFamily)
>                 .addFamily(yFamily)
>                 .addFamily(zFamily);
>
>         ResultScanner scanner = hTable.getScanner(scan);
>
>         Iterator<Result> it = scanner.iterator();
>         int resultCount = 0;
>         while (it.hasNext()) {
>               Result result = it.next();
>
>               resultCount++;
>         }
>
> However, I am getting different number of results, depending on which
> families are added.  For example these give different result counts
>
>         scan
>                 //.addFamily(xFamily)
>                 .addFamily(yFamily)
>                 .addFamily(zFamily);
> and
>         scan
>                 .addFamily(xFamily)
>                 .addFamily(yFamily)
>                 .addFamily(zFamily);
>
>
> There is no error message, and I don't see anything in the Scan
> documentation.  Does anyone know what is going on?
>
> Thanks
> Peter
>
>
+
Doug Meil 2012-03-15, 16:39
+
Peter Wolf 2012-03-15, 16:52
+
lars hofhansl 2012-03-15, 17:04
+
Haijia Zhou 2012-03-15, 17:12
+
lars hofhansl 2012-03-15, 17:17
+
Peter Wolf 2012-03-15, 17:48
+
Himanshu Vashishtha 2012-03-15, 18:42
+
Peter Wolf 2012-03-15, 19:05
+
Daniel Gómez Ferro 2012-03-15, 19:25
+
Peter Wolf 2012-03-15, 19:41
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