예제 #1
0
  /**
   * @param bytes
   * @return cuboid ID
   */
  public long split(byte[] bytes) {
    this.bufferSize = 0;
    int offset = 0;

    if (enableSharding) {
      // extract shard
      SplittedBytes shardSplit = this.splitBuffers[this.bufferSize++];
      shardSplit.length = RowConstants.ROWKEY_SHARDID_LEN;
      System.arraycopy(bytes, offset, shardSplit.value, 0, RowConstants.ROWKEY_SHARDID_LEN);
      offset += RowConstants.ROWKEY_SHARDID_LEN;
      // lastSplittedShard = Bytes.toShort(shardSplit.value, 0, shardSplit.length);
    }

    // extract cuboid id
    SplittedBytes cuboidIdSplit = this.splitBuffers[this.bufferSize++];
    cuboidIdSplit.length = RowConstants.ROWKEY_CUBOIDID_LEN;
    System.arraycopy(bytes, offset, cuboidIdSplit.value, 0, RowConstants.ROWKEY_CUBOIDID_LEN);
    offset += RowConstants.ROWKEY_CUBOIDID_LEN;

    lastSplittedCuboidId = Bytes.toLong(cuboidIdSplit.value, 0, cuboidIdSplit.length);
    Cuboid cuboid = Cuboid.findById(cubeDesc, lastSplittedCuboidId);

    // rowkey columns
    for (int i = 0; i < cuboid.getColumns().size(); i++) {
      TblColRef col = cuboid.getColumns().get(i);
      int colLength = colIO.getColumnLength(col);
      SplittedBytes split = this.splitBuffers[this.bufferSize++];
      split.length = colLength;
      System.arraycopy(bytes, offset, split.value, 0, colLength);
      offset += colLength;
    }

    return lastSplittedCuboidId;
  }
 public HBaseKeyRange(
     Collection<TblColRef> dimensionColumns,
     Collection<ColumnValueRange> andDimensionRanges,
     CubeSegment cubeSeg,
     CubeDesc cubeDesc) {
   this.cubeSeg = cubeSeg;
   long cuboidId = this.calculateCuboidID(cubeDesc, dimensionColumns);
   this.cuboid = Cuboid.findById(cubeDesc, cuboidId);
   this.flatOrAndFilter = Lists.newLinkedList();
   this.flatOrAndFilter.add(andDimensionRanges);
   init(andDimensionRanges);
   initDebugString();
 }