Search in sources :

Example 1 with RowkeyColumnSecondarySort

use of com.rainsoft.hbase.RowkeyColumnSecondarySort in project beijingThirdPeriod by weidongcao.

the class HBaseUtils method getHFileCellListByRow.

/**
 * 根据一条数据及字段名和HBase的RowKey生成HBase的一条数据的多个Cell
 *
 * @param row     一条数据的多个字段
 * @param columns 字段名数组
 * @param rowkey  HBase的RowKey
 * @return 经过二次排序的RDD
 */
public static List<Tuple2<RowkeyColumnSecondarySort, String>> getHFileCellListByRow(Row row, String[] columns, String rowkey) {
    // 返回结果集
    List<Tuple2<RowkeyColumnSecondarySort, String>> list = new ArrayList<>();
    for (int j = 0; j < columns.length; j++) {
        Object value = row.get(j);
        if (null != value) {
            RowkeyColumnSecondarySort sort = new RowkeyColumnSecondarySort(rowkey, columns[j]);
            list.add(new Tuple2<>(sort, value.toString()));
        }
    }
    return list;
}
Also used : RowkeyColumnSecondarySort(com.rainsoft.hbase.RowkeyColumnSecondarySort) Tuple2(scala.Tuple2) ArrayList(java.util.ArrayList)

Aggregations

RowkeyColumnSecondarySort (com.rainsoft.hbase.RowkeyColumnSecondarySort)1 ArrayList (java.util.ArrayList)1 Tuple2 (scala.Tuple2)1