|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.util.hash.Hash
public abstract class Hash
This class represents a common API for hashing functions.
| Field Summary | |
|---|---|
static int |
INVALID_HASH
Constant to denote invalid hash type. |
static int |
JENKINS_HASH
Constant to denote JenkinsHash. |
static int |
MURMUR_HASH
Constant to denote MurmurHash. |
| Constructor Summary | |
|---|---|
Hash()
|
|
| Method Summary | |
|---|---|
static int |
getHashType(Configuration conf)
This utility method converts the name of the configured hash type to a symbolic constant. |
static Hash |
getInstance(Configuration conf)
Get a singleton instance of hash function of a type defined in the configuration. |
static Hash |
getInstance(int type)
Get a singleton instance of hash function of a given type. |
int |
hash(byte[] bytes)
Calculate a hash using all bytes from the input argument, and a seed of -1. |
int |
hash(byte[] bytes,
int initval)
Calculate a hash using all bytes from the input argument, and a provided seed value. |
abstract int |
hash(byte[] bytes,
int length,
int initval)
Calculate a hash using bytes from 0 to length, and
the provided seed value |
static int |
parseHashType(String name)
This utility method converts String representation of hash function name to a symbolic constant. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int INVALID_HASH
public static final int JENKINS_HASH
JenkinsHash.
public static final int MURMUR_HASH
MurmurHash.
| Constructor Detail |
|---|
public Hash()
| Method Detail |
|---|
public static int parseHashType(String name)
name - hash function name
public static int getHashType(Configuration conf)
conf - configuration
public static Hash getInstance(int type)
type - predefined hash type
public static Hash getInstance(Configuration conf)
conf - current configuration
public int hash(byte[] bytes)
bytes - input bytes
public int hash(byte[] bytes,
int initval)
bytes - input bytesinitval - seed value
public abstract int hash(byte[] bytes,
int length,
int initval)
length, and
the provided seed value
bytes - input byteslength - length of the valid bytes to considerinitval - seed value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||