gpt4 book ai didi

java - HBase countRow Nullpointer异常在validateArgAndGetPB

转载 作者:行者123 更新时间:2023-12-02 20:35:07 25 4
gpt4 key购买 nike

您好,我正在使用Hbase。
我想计算表的行数,所以我使用了AggregationClient.rowCount()

        Configuration conf = HBaseConfiguration.create();
AggregationClient aggregationClient = new AggregationClient(conf);
HTable htable=new HTable(conf,Bytes.toBytes("comment"));
Scan scan = new Scan();
scan.addFamily(Bytes.toBytes("user"));
try{
long rowCount = aggregationClient.rowCount( htable , null , scan);
System.out.println("Row Count : "+rowCount);

}catch(Throwable e) {
e.printStackTrace();
}

但是我遇到了零点异常

java.lang.NullPointerException at org.apache.hadoop.hbase.client.coprocessor.AggregationClient.validateArgAndGetPB(AggregationClient.java:804) at org.apache.hadoop.hbase.client.coprocessor.AggregationClient.rowCount(AggregationClient.java:306) at com.naver.hbase.Main.countRows(Main.java:131) at com.naver.hbase.Main.main(Main.java:58)



我该如何解决?

最佳答案

好了,rowCount方法需要3个参数

long rowCount(final Table table, final ColumnInterpreter<R, S, P, Q, T> ci, final Scan scan) throws Throwable {

然后哪个
final AggregateRequest requestArg = validateArgAndGetPB(scan, ci, false);

您正在传递 ci = null,问题就在那里

关于java - HBase countRow Nullpointer异常在validateArgAndGetPB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51437367/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com