Enum StringEncoding
- java.lang.Object
-
- java.lang.Enum<StringEncoding>
-
- org.apache.druid.java.util.common.StringEncoding
-
- All Implemented Interfaces:
Serializable
,Comparable<StringEncoding>
,Cacheable
public enum StringEncoding extends Enum<StringEncoding> implements Cacheable
An enum that provides a way for users to specify what encoding should be used when hashing strings. The main reason for this setting's existence is getting the best performance possible. When operating on memory mapped segments -- which store strings as UTF-8 -- it is fastest to use "UTF8". When operating on the result of expressions, or on an in-heap IncrementalIndex -- which use Java strings -- it is fastest to use "UTF16LE". This decision cannot be made locally, because different encodings do not generate equivalent hashes, and therefore they are not mergeable. The decision must be made globally by the end user or by the SQL planner, and should be based on where most input strings are expected to come from. Currently, UTF8 and UTF16LE are the only two options, because there are no situations where other options would be higher-performing.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringEncoding
fromString(String name)
byte[]
getCacheKey()
Get a byte array used as a cache key.String
toString()
static StringEncoding
valueOf(String name)
Returns the enum constant of this type with the specified name.static StringEncoding[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UTF8
public static final StringEncoding UTF8
-
UTF16LE
public static final StringEncoding UTF16LE
-
-
Method Detail
-
values
public static StringEncoding[] 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 (StringEncoding c : StringEncoding.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static StringEncoding 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
-
fromString
public static StringEncoding fromString(String name)
-
getCacheKey
public byte[] getCacheKey()
Description copied from interface:Cacheable
Get a byte array used as a cache key.- Specified by:
getCacheKey
in interfaceCacheable
- Returns:
- a cache key
-
toString
public String toString()
- Overrides:
toString
in classEnum<StringEncoding>
-
-