【发布时间】:2018-07-20 07:32:58
【问题描述】:
您好,我正在使用 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 在 org.apache.hadoop.hbase.client.coprocessor.AggregationClient.validateArgAndGetPB(AggregationClient.java:804) 在 org.apache.hadoop.hbase.client.coprocessor.AggregationClient.rowCount(AggregationClient.java:306) 在 com.naver.hbase.Main.countRows(Main.java:131) 在 com.naver.hbase.Main.main(Main.java:58)
我该如何解决?
【问题讨论】:
-
能否也添加 aggregationClient 代码?
-
我使用了 Hbase 聚合客户端类
标签: java hadoop nullpointerexception hbase bigdata