org.apache.kylin.common.util.Bytes.hashCode()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.apache.kylin.common.util.Bytes.hashCode()方法的一些代码示例,展示了Bytes.hashCode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.hashCode()方法的具体详情如下:
包路径:org.apache.kylin.common.util.Bytes
类名称:Bytes
方法名:hashCode

Bytes.hashCode介绍

暂无

代码示例

代码示例来源:origin: apache/kylin

/**
 * @param b bytes to hash
 * @return Runs {@link org.apache.hadoop.io.WritableComparator#hashBytes(byte[], int)} on the
 * passed in array.  This method is what {@link org.apache.hadoop.io.Text} and
 * {@link org.apache.hadoop.hbase.io.ImmutableBytesWritable} use calculating hash code.
 */
public static int hashCode(final byte[] b) {
  return hashCode(b, b.length);
}

代码示例来源:origin: apache/kylin

/**
 * @param b      bytes to hash
 * @param length length to hash
 * @return A hash of <code>b</code> as an Integer that can be used as key in
 * Maps.
 */
public static Integer mapKey(final byte[] b, final int length) {
  return hashCode(b, length);
}

代码示例来源:origin: apache/kylin

/**
 * @param b bytes to hash
 * @return A hash of <code>b</code> as an Integer that can be used as key in
 * Maps.
 */
public static Integer mapKey(final byte[] b) {
  return hashCode(b);
}

代码示例来源:origin: apache/kylin

@Override
public int hashCode() {
  if (data == null)
    return 0;
  else
    return Bytes.hashCode(data, offset, length);
}

代码示例来源:origin: apache/kylin

/** Compute hash for binary data. */
public static int hashBytes(byte[] bytes, int offset, int length) {
  return hashCode(bytes, offset, length);
}

代码示例来源:origin: apache/kylin

@Override
public int hashCode() {
  if (data == null) {
    return 0;
  } else {
    if (length <= Bytes.SIZEOF_LONG && length > 0) {
      // to avoid hash collision of byte arrays those are converted from nearby integers/longs, which is the case for kylin dictionary
      long value = BytesUtil.readLong(data, offset, length);
      return (int) (value ^ (value >>> 32));
    }
    return Bytes.hashCode(data, offset, length);
  }
}

代码示例来源:origin: org.apache.kylin/kylin-common

/**
 * @param b      bytes to hash
 * @param length length to hash
 * @return A hash of <code>b</code> as an Integer that can be used as key in
 * Maps.
 */
public static Integer mapKey(final byte[] b, final int length) {
  return hashCode(b, length);
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

/**
 * @param b bytes to hash
 * @return A hash of <code>b</code> as an Integer that can be used as key in
 * Maps.
 */
public static Integer mapKey(final byte[] b) {
  return hashCode(b);
}

代码示例来源:origin: org.apache.kylin/kylin-engine-mr

@Override
public int hashCode() {
  if (data == null)
    return 0;
  else
    return Bytes.hashCode(data, offset, length);
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

/**
 * @param b      bytes to hash
 * @param length length to hash
 * @return A hash of <code>b</code> as an Integer that can be used as key in
 * Maps.
 */
public static Integer mapKey(final byte[] b, final int length) {
  return hashCode(b, length);
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

/**
 * @param b bytes to hash
 * @return Runs {@link org.apache.hadoop.io.WritableComparator#hashBytes(byte[], int)} on the
 * passed in array.  This method is what {@link org.apache.hadoop.io.Text} and
 * {@link org.apache.hadoop.hbase.io.ImmutableBytesWritable} use calculating hash code.
 */
public static int hashCode(final byte[] b) {
  return hashCode(b, b.length);
}

代码示例来源:origin: org.apache.kylin/kylin-common

/**
 * @param b bytes to hash
 * @return Runs {@link org.apache.hadoop.io.WritableComparator#hashBytes(byte[], int)} on the
 * passed in array.  This method is what {@link org.apache.hadoop.io.Text} and
 * {@link org.apache.hadoop.hbase.io.ImmutableBytesWritable} use calculating hash code.
 */
public static int hashCode(final byte[] b) {
  return hashCode(b, b.length);
}

代码示例来源:origin: org.apache.kylin/kylin-common

/**
 * @param b bytes to hash
 * @return A hash of <code>b</code> as an Integer that can be used as key in
 * Maps.
 */
public static Integer mapKey(final byte[] b) {
  return hashCode(b);
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

/** Compute hash for binary data. */
public static int hashBytes(byte[] bytes, int offset, int length) {
  return hashCode(bytes, offset, length);
}

代码示例来源:origin: org.apache.kylin/kylin-common

@Override
public int hashCode() {
  return Bytes.hashCode(data);
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

@Override
public int hashCode() {
  if (data == null) {
    return 0;
  } else {
    if (length <= Bytes.SIZEOF_LONG && length > 0) {
      // to avoid hash collision of byte arrays those are converted from nearby integers/longs, which is the case for kylin dictionary
      long value = BytesUtil.readLong(data, offset, length);
      return (int) (value ^ (value >>> 32));
    }
    return Bytes.hashCode(data, offset, length);
  }
}

相关文章