Package com.linkedin.davinci.compression
Class UrnDictV1
java.lang.Object
com.linkedin.davinci.compression.UrnDictV1
This class implements a URN dictionary for encoding and decoding URNs.
The dictionary maps URN types to integer IDs to reduce the size of URNs when stored
in a data store or transmitted over the network.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final RecordDeserializer<Object>static final org.apache.avro.Schemastatic final RecordSerializer<Object>static final intstatic final Stringstatic final intstatic final Character -
Method Summary
Modifier and TypeMethodDescriptionstatic UrnDictV1loadDict(byte[] dict, int maxDictSize) static UrnDictV1loadDict(ByteBuffer dict) static UrnDictV1loadDict(ByteBuffer dict, int maxDictSize) static UrnDictV1static UrnDictV1byte[]static UrnDictV1static voidvalidateDict(Map<String, Integer> dict) This function will validate the dictionary in the following ways: 1.
-
Field Details
-
DEFAULT_MAX_DICT_SIZE
public static final int DEFAULT_MAX_DICT_SIZE- See Also:
-
URN_PREFIX
- See Also:
-
URN_SEPARATOR
-
URN_PREFIX_LENGTH
public static final int URN_PREFIX_LENGTH -
UNKNOWN_URN_TYPE_ID
public static final int UNKNOWN_URN_TYPE_ID- See Also:
-
DICT_SCHEMA
public static final org.apache.avro.Schema DICT_SCHEMA -
DICT_SERIALIZER
-
DICT_DESERIALIZER
-
-
Method Details
-
validateDict
This function will validate the dictionary in the following ways: 1. Make sure the dictionary is not null. 2. Make sure the mapped ids are in the range of [0, dict.size() - 1). 3. Make sure there are no duplicate ids. When validation fail, it will throw an VeniceException. -
getUrnToIdMap
-
loadDict
-
loadDict
-
loadDict
-
loadDict
-
loadDict
-
serializeDict
public byte[] serializeDict() -
trainDict
-
encodeUrn
-
encodeUrn
-
decodeUrn
-