Beispiel #1
0
  /**
   * hbaseのsc_item_dataのrow-keyを生成する
   *
   * @param shopID 店舗ID
   * @param itemID 商品ID
   * @return row-key
   */
  public static byte[] encodeRowkey(int shopID, int itemID) {
    if (shopID == -1 || itemID == -1) {
      return new byte[0];
    }

    // row key: shop_id + item_id
    byte[] bshopid = ByteArray.toByte32Radix(shopID, SIZE_OF_SHOP_ID_32);
    byte[] bitemid = ByteArray.toByte32Radix(itemID, SIZE_OF_ITEM_ID_32);
    byte[] rowKey = ByteArray.concatenate(bshopid, bitemid);
    return rowKey;
  }