如何用给定列(非空)过滤出行? [英] How to filter out rows with given column(not null)?

查看:187
本文介绍了如何用给定列(非空)过滤出行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用滤镜进行hbase扫描。例如,我的表具有列族A,B,C,而且A具有列X.一些行具有列X,而一些行不具有列。我怎样才能实现过滤器过滤掉列X的所有行?

解决方案

我想你正在寻找<$ c HBase中的$ c> SingleColumnValueFilter 。正如 API中所述, a>


如果在一行中找不到列,那么要防止发出整行,可以使用 setFilterIfMissing (布尔)在Filter对象上。否则,如果找到该列,则只有当该值通过时,整行才会被发射。

但是 SingleColumnValueFilter 如果值失败,如果ColumnX不能使用的定点值,如果ColumnX ==X

带上了这一行和 setFilterIfMissing(true),这样如果ColumnX有一些值,它会返回。



你在正确的方向。

I want to do a hbase scan with filters. For example, my table has column family A,B,C, and A has a column X. Some rows have the column X and some do not. How can I implement the filter to filter out all the rows with column X?

解决方案

I guess you are looking for SingleColumnValueFilter in HBase. As mentioned in the API

To prevent the entire row from being emitted if the column is not found on a row, use setFilterIfMissing(boolean) on Filter object. Otherwise, if the column is found, the entire row will be emitted only if the value passes. If the value fails, the row will be filtered out.

But SingleColumnValueFilter would want a value to have Column X "CompareOp" to something, say bring this row if ColumnX == "X" or bring this row if ColumnX != "A sentinel value that ColumnX can never take" and setFilterIfMissing(true) so that if ColumnX has some value, it is returned.

I hope this nudges you in the right direction.

这篇关于如何用给定列(非空)过滤出行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆