JenkinsHash, MurmurHash@Private
@Unstable
public abstract class Hash
extends java.lang.Object
| Modifier and Type | Field | 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. |
| Constructor | Description |
|---|---|
Hash() |
| Modifier and Type | Method | Description |
|---|---|---|
static int |
getHashType(Configuration conf) |
This utility method converts the name of the configured
hash type to a symbolic constant.
|
static Hash |
getInstance(int type) |
Get a singleton instance of hash function of a given type.
|
static Hash |
getInstance(Configuration conf) |
Get a singleton instance of hash function of a type
defined in the configuration.
|
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(java.lang.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 int parseHashType(java.lang.String name)
name - hash function namepublic static int getHashType(Configuration conf)
conf - configurationpublic static Hash getInstance(int type)
type - predefined hash typepublic static Hash getInstance(Configuration conf)
conf - current configurationpublic int hash(byte[] bytes)
bytes - input bytespublic int hash(byte[] bytes,
int initval)
bytes - input bytesinitval - seed valuepublic abstract int hash(byte[] bytes,
int length,
int initval)
length, and
the provided seed valuebytes - input byteslength - length of the valid bytes to considerinitval - seed valueCopyright © 2008–2025 Apache Software Foundation. All rights reserved.