Updated on 2023-01-11 GMT+08:00

Obtaining Statistics of Row

Operation Scenario

The number of rows that meet specific requirements can be counted based on the rowkey naming rule, rowkey scope, field name, and field value.

Procedure

Run the following commands to count the number of rows that meet the requirements. The rowkey is in the scope from row_start to row_stop. The field name is f3:age and the field value is 25. The first two characters of the rowkey are mi.

hbase com.huawei.hadoop.hbase.tools.bulkload.RowCounter -Dcounter.rowkey.start="row_start" -Dcounter.rowkey.stop="row_stop" -Dcounter.qualifier="f3:age:25" -Dcounter.rowkey.value="substring(0,2) == 'mi'" table1
  • -Dcounter.rowkey.start="row_start": indicates that the start rowkey is row_start.
  • -Dcounter.rowkey.stop="row_stop": indicates that the end rowkey is row_stop.
  • -Dcounter.qualifier="f3:age:25": indicates that the value of column age in column family f3 is 25.
  • -Dcounter.rowkey.value="substring(0,2) == 'mi'": indicates that the first two values of the rowkey are mi.

If row_start and row_stop are specified, data whose values are greater than or equal to row_start and less than row_stop is counted.