![](/img/trans.png)
[英]How to use Hbase's RowCounter class to get number of rows in a table?
[英]Which jar file contains RowCounter class for Hbase
我沒辦法。 我找不到哪個jar文件包含以下兩個類:
import org.apache.hadoop.hbase.mapreduce.RowCounter.RowCounterMapper;
import org.junit.experimental.categories.Category;
我試過了:
Eclipse仍然說那些導入行沒有解決。
如何找到包含這些類或程序需要編譯的任何類的jar文件?
提前致謝。 我准備把頭撞到牆上。
RowCounterMapper
在HBase服務器中。 Maven的依賴:
<!-- https://mvnrepository.com/artifact/org.apache.hbase/hbase --> <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase</artifactId> <version>1.2.1</version> <type>pom</type> </dependency>
Category
位於Junit 4中。Maven依賴項: <!-- https://mvnrepository.com/artifact/junit/junit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency>
-https://mvnrepository.com/artifact/junit/junit- <!-- https://mvnrepository.com/artifact/junit/junit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency>
我還添加了指向GrepCode的鏈接。
底座上的評論,@Classified想要一個例子來運行RowCounter
。
這是我寫的單元測試,我認為這可能是一個很好的例子。
Job job = RowCounter.createSubmittableJob(HBaseConfiguration.create(), new String[]{"table"});
job.waitForCompletion(true);
Counters counters = job.getCounters();
GenericCounter genericCounter = (GenericCounter) counters.findCounter(
"org.apache.hadoop.hbase.mapreduce.RowCounter$RowCounterMapper$Counters",
"ROWS");
genericCounter.getValue();
genericCounter.getValue()
是"table"
的行數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.