@InterfaceAudience.Private @InterfaceStability.Stable public abstract class Hash extends Object
Modifier and Type | Field and Description |
---|---|
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 . |
static int |
MURMUR_HASH3
Constant to denote
MurmurHash3 . |
Constructor and Description |
---|
Hash() |
Modifier and Type | Method and Description |
---|---|
static int |
getHashType(org.apache.hadoop.conf.Configuration conf)
This utility method converts the name of the configured
hash type to a symbolic constant.
|
static Hash |
getInstance(org.apache.hadoop.conf.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.
|
int |
hash(byte[] bytes,
int length,
int initval)
Calculate a hash using bytes from 0 to
length , and
the provided seed value |
abstract int |
hash(byte[] bytes,
int offset,
int length,
int initval)
Calculate a hash using bytes from
offset to offset +
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.
|
public static final int INVALID_HASH
public static final int JENKINS_HASH
JenkinsHash
.public static final int MURMUR_HASH
MurmurHash
.public static final int MURMUR_HASH3
MurmurHash3
.public static int parseHashType(String name)
name
- hash function namepublic static int getHashType(org.apache.hadoop.conf.Configuration conf)
conf
- configurationpublic static Hash getInstance(int type)
type
- predefined hash typepublic static Hash getInstance(org.apache.hadoop.conf.Configuration conf)
conf
- current configurationpublic int hash(byte[] bytes)
bytes
- input bytespublic int hash(byte[] bytes, int initval)
bytes
- input bytesinitval
- seed valuepublic int hash(byte[] bytes, int length, int initval)
length
, and
the provided seed valuebytes
- input byteslength
- length of the valid bytes after offset to considerinitval
- seed valuepublic abstract int hash(byte[] bytes, int offset, int length, int initval)
offset
to offset +
length
, and the provided seed value.bytes
- input bytesoffset
- the offset into the array to start considerationlength
- length of the valid bytes after offset to considerinitval
- seed valueCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.