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

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

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

Hash.getInstance介绍

[英]Get a singleton instance of hash function of a given type.
[中]获取给定类型的哈希函数的单例实例。

代码示例

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

/**
 * Get a singleton instance of hash function of a type
 * defined in the configuration.
 * @param conf current configuration
 * @return defined hash type, or null if type is invalid
 */
public static Hash getInstance(Configuration conf) {
 int type = getHashType(conf);
 return getInstance(type);
}

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

/**
 * Constructor.
 * <p>
 * Builds a hash function that must obey to a given maximum number of returned values and a highest value.
 * @param maxValue The maximum highest returned value.
 * @param nbHash The number of resulting hashed values.
 * @param hashType type of the hashing function (see {@link Hash}).
 */
public HashFunction(int maxValue, int nbHash, int hashType) {
 if (maxValue <= 0) {
  throw new IllegalArgumentException("maxValue must be > 0");
 }
 
 if (nbHash <= 0) {
  throw new IllegalArgumentException("nbHash must be > 0");
 }
 this.maxValue = maxValue;
 this.nbHash = nbHash;
 this.hashFunction = Hash.getInstance(hashType);
 if (this.hashFunction == null)
  throw new IllegalArgumentException("hashType must be known");
}

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

/**
 * Constructor.
 * <p>
 * Builds a hash function that must obey to a given maximum number of returned values and a highest value.
 * @param maxValue The maximum highest returned value.
 * @param nbHash The number of resulting hashed values.
 * @param hashType type of the hashing function (see {@link Hash}).
 */
public HashFunction(int maxValue, int nbHash, int hashType) {
 if (maxValue <= 0) {
  throw new IllegalArgumentException("maxValue must be > 0");
 }
 
 if (nbHash <= 0) {
  throw new IllegalArgumentException("nbHash must be > 0");
 }
 this.maxValue = maxValue;
 this.nbHash = nbHash;
 this.hashFunction = Hash.getInstance(hashType);
 if (this.hashFunction == null)
  throw new IllegalArgumentException("hashType must be known");
}

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

/**
 * Get a singleton instance of hash function of a type
 * defined in the configuration.
 * @param conf current configuration
 * @return defined hash type, or null if type is invalid
 */
public static Hash getInstance(Configuration conf) {
 int type = getHashType(conf);
 return getInstance(type);
}

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

/**
 * Get a singleton instance of hash function of a type
 * defined in the configuration.
 * @param conf current configuration
 * @return defined hash type, or null if type is invalid
 */
public static Hash getInstance(Configuration conf) {
 int type = getHashType(conf);
 return getInstance(type);
}

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

/**
 * Constructor.
 * <p>
 * Builds a hash function that must obey to a given maximum number of returned values and a highest value.
 * @param maxValue The maximum highest returned value.
 * @param nbHash The number of resulting hashed values.
 * @param hashType type of the hashing function (see {@link Hash}).
 */
public HashFunction(int maxValue, int nbHash, int hashType) {
 if (maxValue <= 0) {
  throw new IllegalArgumentException("maxValue must be > 0");
 }
 
 if (nbHash <= 0) {
  throw new IllegalArgumentException("nbHash must be > 0");
 }
 this.maxValue = maxValue;
 this.nbHash = nbHash;
 this.hashFunction = Hash.getInstance(hashType);
 if (this.hashFunction == null)
  throw new IllegalArgumentException("hashType must be known");
}

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

/**
 * Get a singleton instance of hash function of a type
 * defined in the configuration.
 * @param conf current configuration
 * @return defined hash type, or null if type is invalid
 */
public static Hash getInstance(Configuration conf) {
 int type = getHashType(conf);
 return getInstance(type);
}

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

/**
 * Get a singleton instance of hash function of a type
 * defined in the configuration.
 * @param conf current configuration
 * @return defined hash type, or null if type is invalid
 */
public static Hash getInstance(Configuration conf) {
 int type = getHashType(conf);
 return getInstance(type);
}

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

/**
 * Get a singleton instance of hash function of a type
 * defined in the configuration.
 * @param conf current configuration
 * @return defined hash type, or null if type is invalid
 */
public static Hash getInstance(Configuration conf) {
 int type = getHashType(conf);
 return getInstance(type);
}

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

/**
 * Constructor.
 * <p>
 * Builds a hash function that must obey to a given maximum number of returned values and a highest value.
 * @param maxValue The maximum highest returned value.
 * @param nbHash The number of resulting hashed values.
 * @param hashType type of the hashing function (see {@link Hash}).
 */
public HashFunction(int maxValue, int nbHash, int hashType) {
 if (maxValue <= 0) {
  throw new IllegalArgumentException("maxValue must be > 0");
 }
 
 if (nbHash <= 0) {
  throw new IllegalArgumentException("nbHash must be > 0");
 }
 this.maxValue = maxValue;
 this.nbHash = nbHash;
 this.hashFunction = Hash.getInstance(hashType);
 if (this.hashFunction == null)
  throw new IllegalArgumentException("hashType must be known");
}

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

/**
 * Constructor.
 * <p>
 * Builds a hash function that must obey to a given maximum number of returned values and a highest value.
 * @param maxValue The maximum highest returned value.
 * @param nbHash The number of resulting hashed values.
 * @param hashType type of the hashing function (see {@link Hash}).
 */
public HashFunction(int maxValue, int nbHash, int hashType) {
 if (maxValue <= 0) {
  throw new IllegalArgumentException("maxValue must be > 0");
 }
 
 if (nbHash <= 0) {
  throw new IllegalArgumentException("nbHash must be > 0");
 }
 this.maxValue = maxValue;
 this.nbHash = nbHash;
 this.hashFunction = Hash.getInstance(hashType);
 if (this.hashFunction == null)
  throw new IllegalArgumentException("hashType must be known");
}

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

/**
 * Constructor.
 * <p>
 * Builds a hash function that must obey to a given maximum number of returned values and a highest value.
 * @param maxValue The maximum highest returned value.
 * @param nbHash The number of resulting hashed values.
 * @param hashType type of the hashing function (see {@link Hash}).
 */
public HashFunction(int maxValue, int nbHash, int hashType) {
 if (maxValue <= 0) {
  throw new IllegalArgumentException("maxValue must be > 0");
 }
 
 if (nbHash <= 0) {
  throw new IllegalArgumentException("nbHash must be > 0");
 }
 this.maxValue = maxValue;
 this.nbHash = nbHash;
 this.hashFunction = Hash.getInstance(hashType);
 if (this.hashFunction == null)
  throw new IllegalArgumentException("hashType must be known");
}

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

/**
 * Constructor.
 * <p>
 * Builds a hash function that must obey to a given maximum number of returned values and a highest value.
 * @param maxValue The maximum highest returned value.
 * @param nbHash The number of resulting hashed values.
 * @param hashType type of the hashing function (see {@link Hash}).
 */
public HashFunction(int maxValue, int nbHash, int hashType) {
 if (maxValue <= 0) {
  throw new IllegalArgumentException("maxValue must be > 0");
 }
 
 if (nbHash <= 0) {
  throw new IllegalArgumentException("nbHash must be > 0");
 }
 this.maxValue = maxValue;
 this.nbHash = nbHash;
 this.hashFunction = Hash.getInstance(hashType);
 if (this.hashFunction == null)
  throw new IllegalArgumentException("hashType must be known");
}

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

assertTrue("testHash", MurmurHash.getInstance() == Hash.getInstance(cfg));
  JenkinsHash.getInstance() == Hash.getInstance(cfg));
  MurmurHash.getInstance() == Hash.getInstance(cfg));
  JenkinsHash.getInstance() == Hash.getInstance(Hash.JENKINS_HASH));
assertTrue("testHash error murmur getInstance !!!",
  MurmurHash.getInstance() == Hash.getInstance(Hash.MURMUR_HASH));
  Hash.getInstance(Hash.INVALID_HASH));
int murmurHash = Hash.getInstance(Hash.MURMUR_HASH).hash(LINE.getBytes());
for (int i = 0; i < iterations; i++) {
 assertTrue("multiple evaluation murmur hash error !!!",
   murmurHash == Hash.getInstance(Hash.MURMUR_HASH)
     .hash(LINE.getBytes()));
murmurHash = Hash.getInstance(Hash.MURMUR_HASH).hash(LINE.getBytes(), 67);
for (int i = 0; i < iterations; i++) {
 assertTrue(
   "multiple evaluation murmur hash error !!!",
   murmurHash == Hash.getInstance(Hash.MURMUR_HASH).hash(
     LINE.getBytes(), 67));
int jenkinsHash = Hash.getInstance(Hash.JENKINS_HASH).hash(LINE.getBytes());
for (int i = 0; i < iterations; i++) {
 assertTrue(
   "multiple evaluation jenkins hash error !!!",

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

assertTrue("testHash", MurmurHash.getInstance() == Hash.getInstance(cfg));
  JenkinsHash.getInstance() == Hash.getInstance(cfg));
  MurmurHash.getInstance() == Hash.getInstance(cfg));
  JenkinsHash.getInstance() == Hash.getInstance(Hash.JENKINS_HASH));
assertTrue("testHash error murmur getInstance !!!",
  MurmurHash.getInstance() == Hash.getInstance(Hash.MURMUR_HASH));
  Hash.getInstance(Hash.INVALID_HASH));
int murmurHash = Hash.getInstance(Hash.MURMUR_HASH).hash(LINE.getBytes());
for (int i = 0; i < iterations; i++) {
 assertTrue("multiple evaluation murmur hash error !!!",
   murmurHash == Hash.getInstance(Hash.MURMUR_HASH)
     .hash(LINE.getBytes()));
murmurHash = Hash.getInstance(Hash.MURMUR_HASH).hash(LINE.getBytes(), 67);
for (int i = 0; i < iterations; i++) {
 assertTrue(
   "multiple evaluation murmur hash error !!!",
   murmurHash == Hash.getInstance(Hash.MURMUR_HASH).hash(
     LINE.getBytes(), 67));
int jenkinsHash = Hash.getInstance(Hash.JENKINS_HASH).hash(LINE.getBytes());
for (int i = 0; i < iterations; i++) {
 assertTrue(
   "multiple evaluation jenkins hash error !!!",

相关文章

微信公众号

最新文章

更多