Updated on 2022-11-18 GMT+08:00

Implementing RowKeys in a Customized Manner

Scenario

You can implement RowKeys in a customized manner. You can edit RowKey implementation codes and import the combined RowKeys based on the code logic.

Configuration Method

  1. When you edit the customized RowKey implementation, the following interface needs to be inherited:

    [com.huawei.hadoop.hbase.tools.bulkload.RowkeyHandlerInterface]

    Interface implementation method:

    byte[] getRowkeyBytes(String[] colsValues, RegulationDomain regulation)

    In the preceding command:

    • colsValues indicates a collection of one original data row. Each element is a column.
    • regulation indicates the configuration of imported file information (This parameter is not used in most cases.).

  1. Package the implementation class and its dependency packages to a JAR file and save the file anywhere on the HBase client.
  1. When running the command for importing files, add the following two parameter configuration items:

    -Dimport.rowkey.jar="indicates the full path of the JAR package in Step 2".

    -Dimport.rowkey.class="indicates the full class name of users implementation class".