Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从HBase检索除特定列族的值以外的所有_Java_Hbase - Fatal编程技术网

Java 从HBase检索除特定列族的值以外的所有

Java 从HBase检索除特定列族的值以外的所有,java,hbase,Java,Hbase,我正在编写一个Java应用程序,它从HBase数据库中检索和显示数据 在编写检索行的Get方法时,我希望获取该行的所有数据,但不包括特定列族(“大”列族)的值。注意:我需要检索该族中的列名(限定符?),因为它们包含有价值的信息 是否可以为此编写一个筛选器 我有两个解决办法。第一个不起作用,第二个相当慢 第一种解决方案(使用复合过滤器): 这个解决方案在概念上和实践中都不起作用——但也许我使用复合过滤器列表的方法是正确的 第二个解决方案(使用两个get): 这是可行的,但我倾向于只执行一个get。

我正在编写一个Java应用程序,它从HBase数据库中检索和显示数据

在编写检索行的Get方法时,我希望获取该行的所有数据,但不包括特定列族(“大”列族)的值。注意:我需要检索该族中的列名(限定符?),因为它们包含有价值的信息

是否可以为此编写一个筛选器

我有两个解决办法。第一个不起作用,第二个相当慢

第一种解决方案(使用复合过滤器):

这个解决方案在概念上和实践中都不起作用——但也许我使用复合过滤器列表的方法是正确的

第二个解决方案(使用两个get):


这是可行的,但我倾向于只执行一个get。

我最终使用了第二个解决方案的变体—使用两个get。但我使用了批处理获取列表来加快速度

守则:

HTable table = getTable();

Get get = new Get(row);
// exclude the entire "big" column family 
get.setFilter(new FamilyFilter(CompareOp.NOT_EQUAL, new BinaryComparator(Bytes.toBytes("big"))));

Get get2 = new Get(row);
// include the "big" column family, but only retrieve the key 
FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL);
filterList.addFilter(new KeyOnlyFilter());
filterList.addFilter(new FamilyFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("big"))));
get2.setFilter(filterList);

List<Get> getList = new ArrayList<Get>();
getList.add(get);
getList.add(get2);
retrieveAndUseResults(table, getList);
HTable table=getTable();
获取=新获取(行);
//排除整个“大”列族
get.setFilter(新的FamilyFilter(CompareOp.NOT_EQUAL,新的二进制比较器(Bytes.toBytes(“big”)));
Get get2=新Get(行);
//包括“大”列族,但仅检索键
FilterList FilterList=新的FilterList(FilterList.Operator.MUST\u PASS\u ALL);
addFilter(新的KeyOnlyFilter());
addFilter(新的FamilyFilter(CompareOp.EQUAL,新的BinaryComparator(Bytes.toBytes(“大”)));
get2.setFilter(过滤器列表);
List getList=newarraylist();
添加(get);
getList.add(get2);
检索所有结果(表,getList);
HTable table = getTable();
Get get = new Get(row);
// exclude the entire "big" column family 
get.setFilter(new FamilyFilter(CompareOp.NOT_EQUAL, new BinaryComparator(Bytes.toBytes("big"))));
retrieveAndUseResult(table, get);

Get get2 = new Get(row);
// include the "big" column family, but only retrieve the key 
FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL);
filterList.addFilter(new KeyOnlyFilter());
filterList.addFilter(new FamilyFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("big"))));
get2.setFilter(filterList);
retrieveAndUseResult(table, get2);
HTable table = getTable();

Get get = new Get(row);
// exclude the entire "big" column family 
get.setFilter(new FamilyFilter(CompareOp.NOT_EQUAL, new BinaryComparator(Bytes.toBytes("big"))));

Get get2 = new Get(row);
// include the "big" column family, but only retrieve the key 
FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL);
filterList.addFilter(new KeyOnlyFilter());
filterList.addFilter(new FamilyFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("big"))));
get2.setFilter(filterList);

List<Get> getList = new ArrayList<Get>();
getList.add(get);
getList.add(get2);
retrieveAndUseResults(table, getList);