Enum HashPartitionFunction
- java.lang.Object
-
- java.lang.Enum<HashPartitionFunction>
-
- org.apache.druid.timeline.partition.HashPartitionFunction
-
- All Implemented Interfaces:
Serializable
,Comparable<HashPartitionFunction>
public enum HashPartitionFunction extends Enum<HashPartitionFunction>
An enum of supported hash partition functions. This enum should be updated when we want to use a new function for hash partitioning. All partition functions listed in this enum must be backwards-compatible as the hash function should apply to all segments in the same way no matter what Druid version was used to create those segments. This function is a part ofHashBasedNumberedShardSpec
which is stored in the metadata store.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description MURMUR3_32_ABS
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static HashPartitionFunction
fromString(String type)
abstract int
hash(byte[] serializedRow, int numBuckets)
Returns an ID of a hash bucket for the givenserializedRow
.String
toString()
static HashPartitionFunction
valueOf(String name)
Returns the enum constant of this type with the specified name.static HashPartitionFunction[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
MURMUR3_32_ABS
public static final HashPartitionFunction MURMUR3_32_ABS
-
-
Method Detail
-
values
public static HashPartitionFunction[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (HashPartitionFunction c : HashPartitionFunction.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static HashPartitionFunction valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
hash
public abstract int hash(byte[] serializedRow, int numBuckets)
Returns an ID of a hash bucket for the givenserializedRow
.
-
fromString
public static HashPartitionFunction fromString(String type)
-
toString
public String toString()
- Overrides:
toString
in classEnum<HashPartitionFunction>
-
-