本文整理汇总了Java中org.apache.kylin.common.util.BytesUtil.writeShort方法的典型用法代码示例。如果您正苦于以下问题:Java BytesUtil.writeShort方法的具体用法?Java BytesUtil.writeShort怎么用?Java BytesUtil.writeShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.kylin.common.util.BytesUtil
的用法示例。
在下文中一共展示了BytesUtil.writeShort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRowKeysDifferentShards
import org.apache.kylin.common.util.BytesUtil; //导入方法依赖的package包/类
private List<byte[]> getRowKeysDifferentShards(byte[] halfCookedKey) {
final short cuboidShardNum = cubeSeg.getCuboidShardNum(cuboid.getId());
if (!cubeSeg.isEnableSharding()) {
return Lists.newArrayList(halfCookedKey);//not shard to append at head, so it is already well cooked
} else {
List<byte[]> ret = Lists.newArrayList();
for (short i = 0; i < cuboidShardNum; ++i) {
short shard = ShardingHash.normalize(cubeSeg.getCuboidBaseShard(cuboid.getId()), i, cubeSeg.getTotalShards(cuboid.getId()));
byte[] cookedKey = Arrays.copyOf(halfCookedKey, halfCookedKey.length);
BytesUtil.writeShort(shard, cookedKey, 0, RowConstants.ROWKEY_SHARDID_LEN);
ret.add(cookedKey);
}
return ret;
}
}
示例2: fillHeader
import org.apache.kylin.common.util.BytesUtil; //导入方法依赖的package包/类
protected void fillHeader(byte[] bytes) {
int offset = 0;
if (enableSharding) {
short shard = calculateShard(bytes);
BytesUtil.writeShort(shard, bytes, offset, RowConstants.ROWKEY_SHARDID_LEN);
offset += RowConstants.ROWKEY_SHARDID_LEN;
}
System.arraycopy(cuboid.getBytes(), 0, bytes, offset, RowConstants.ROWKEY_CUBOIDID_LEN);
//offset += RowConstants.ROWKEY_CUBOIDID_LEN;
//return offset;
}