org.apache.hadoop.util.hash.Hash.hash()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(172)

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

Hash.hash介绍

[英]Calculate a hash using all bytes from the input argument, and a seed of -1.
[中]使用输入参数中的所有字节和-1的种子计算哈希。

代码示例

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

/**
 * Calculate a hash using all bytes from the input argument, and
 * a seed of -1.
 * @param bytes input bytes
 * @return hash value
 */
public int hash(byte[] bytes) {
 return hash(bytes, bytes.length, -1);
}

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

/**
 * Calculate a hash using all bytes from the input argument,
 * and a provided seed value.
 * @param bytes input bytes
 * @param initval seed value
 * @return hash value
 */
public int hash(byte[] bytes, int initval) {
 return hash(bytes, bytes.length, initval);
}

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

/**
  * Hashes a specified key into several integers.
  * @param k The specified key.
  * @return The array of hashed values.
  */
 public int[] hash(Key k){
   byte[] b = k.getBytes();
   if (b == null) {
    throw new NullPointerException("buffer reference is null");
   }
   if (b.length == 0) {
    throw new IllegalArgumentException("key length must be > 0");
   }
   int[] result = new int[nbHash];
   for (int i = 0, initval = 0; i < nbHash; i++) {
   initval = hashFunction.hash(b, initval);
   result[i] = Math.abs(initval % maxValue);
   }
   return result;
 }
}

代码示例来源:origin: h2oai/h2o-2

for (int i = 0; i < numcat; ++i) {
 ByteBuffer buf = ByteBuffer.allocate(4);
 int hashval = murmur.hash(buf.putInt(cats[i]).array(), 4, (int)params.seed); // turn horizontalized categorical integer into another integer, based on seed

代码示例来源:origin: io.hops/hadoop-common

/**
 * Calculate a hash using all bytes from the input argument, and
 * a seed of -1.
 * @param bytes input bytes
 * @return hash value
 */
public int hash(byte[] bytes) {
 return hash(bytes, bytes.length, -1);
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

/**
 * Calculate a hash using all bytes from the input argument,
 * and a provided seed value.
 * @param bytes input bytes
 * @param initval seed value
 * @return hash value
 */
public int hash(byte[] bytes, int initval) {
 return hash(bytes, bytes.length, initval);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/**
 * Calculate a hash using all bytes from the input argument,
 * and a provided seed value.
 * @param bytes input bytes
 * @param initval seed value
 * @return hash value
 */
public int hash(byte[] bytes, int initval) {
 return hash(bytes, bytes.length, initval);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/**
 * Calculate a hash using all bytes from the input argument, and
 * a seed of -1.
 * @param bytes input bytes
 * @return hash value
 */
public int hash(byte[] bytes) {
 return hash(bytes, bytes.length, -1);
}

代码示例来源:origin: io.hops/hadoop-common

/**
 * Calculate a hash using all bytes from the input argument,
 * and a provided seed value.
 * @param bytes input bytes
 * @param initval seed value
 * @return hash value
 */
public int hash(byte[] bytes, int initval) {
 return hash(bytes, bytes.length, initval);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/**
 * Calculate a hash using all bytes from the input argument, and
 * a seed of -1.
 * @param bytes input bytes
 * @return hash value
 */
public int hash(byte[] bytes) {
 return hash(bytes, bytes.length, -1);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/**
 * Calculate a hash using all bytes from the input argument,
 * and a provided seed value.
 * @param bytes input bytes
 * @param initval seed value
 * @return hash value
 */
public int hash(byte[] bytes, int initval) {
 return hash(bytes, bytes.length, initval);
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

/**
 * Calculate a hash using all bytes from the input argument, and
 * a seed of -1.
 * @param bytes input bytes
 * @return hash value
 */
public int hash(byte[] bytes) {
 return hash(bytes, bytes.length, -1);
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Calculate a hash using all bytes from the input argument, and
 * a seed of -1.
 * @param bytes input bytes
 * @return hash value
 */
public int hash(byte[] bytes) {
 return hash(bytes, bytes.length, -1);
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Calculate a hash using all bytes from the input argument,
 * and a provided seed value.
 * @param bytes input bytes
 * @param initval seed value
 * @return hash value
 */
public int hash(byte[] bytes, int initval) {
 return hash(bytes, bytes.length, initval);
}

代码示例来源:origin: NationalSecurityAgency/datawave

/**
 * Hash the data
 * 
 * @param data
 */
private void hash(byte[] data) {
  if (optionalPrefix == null) {
    optionalPrefix = Integer.toString(hash.hash(data, data.length, SEED0), RADIX);
  }
  h1 = hash.hash(data, data.length, SEED1);
  h2 = hash.hash(data, data.length, SEED2);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/**
  * Hashes a specified key into several integers.
  * @param k The specified key.
  * @return The array of hashed values.
  */
 public int[] hash(Key k){
   byte[] b = k.getBytes();
   if (b == null) {
    throw new NullPointerException("buffer reference is null");
   }
   if (b.length == 0) {
    throw new IllegalArgumentException("key length must be > 0");
   }
   int[] result = new int[nbHash];
   for (int i = 0, initval = 0; i < nbHash; i++) {
   initval = hashFunction.hash(b, initval);
   result[i] = Math.abs(initval % maxValue);
   }
   return result;
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
  * Hashes a specified key into several integers.
  * @param k The specified key.
  * @return The array of hashed values.
  */
 public int[] hash(Key k){
   byte[] b = k.getBytes();
   if (b == null) {
    throw new NullPointerException("buffer reference is null");
   }
   if (b.length == 0) {
    throw new IllegalArgumentException("key length must be > 0");
   }
   int[] result = new int[nbHash];
   for (int i = 0, initval = 0; i < nbHash; i++) {
   initval = hashFunction.hash(b, initval);
   result[i] = Math.abs(initval % maxValue);
   }
   return result;
 }
}

代码示例来源:origin: mayconbordin/streaminer

/**
  * Hashes a specified key into several integers.
  * @param k The specified key.
  * @return The array of hashed values.
  */
 public int[] hash(Key k){
   byte[] b = k.getBytes();
   if (b == null) {
    throw new NullPointerException("buffer reference is null");
   }
   if (b.length == 0) {
    throw new IllegalArgumentException("key length must be > 0");
   }
   int[] result = new int[nbHash];
   for (int i = 0, initval = 0; i < nbHash; i++) {
   initval = hashFunction.hash(b, initval);
   result[i] = Math.abs(initval % maxValue);
   }
   return result;
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/**
  * Hashes a specified key into several integers.
  * @param k The specified key.
  * @return The array of hashed values.
  */
 public int[] hash(Key k){
   byte[] b = k.getBytes();
   if (b == null) {
    throw new NullPointerException("buffer reference is null");
   }
   if (b.length == 0) {
    throw new IllegalArgumentException("key length must be > 0");
   }
   int[] result = new int[nbHash];
   for (int i = 0, initval = 0; i < nbHash; i++) {
   initval = hashFunction.hash(b, initval);
   result[i] = Math.abs(initval % maxValue);
   }
   return result;
 }
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

/**
  * Hashes a specified key into several integers.
  * @param k The specified key.
  * @return The array of hashed values.
  */
 public int[] hash(Key k){
   byte[] b = k.getBytes();
   if (b == null) {
    throw new NullPointerException("buffer reference is null");
   }
   if (b.length == 0) {
    throw new IllegalArgumentException("key length must be > 0");
   }
   int[] result = new int[nbHash];
   for (int i = 0, initval = 0; i < nbHash; i++) {
   initval = hashFunction.hash(b, initval);
   result[i] = Math.abs(initval % maxValue);
   }
   return result;
 }
}

相关文章