Package org.apache.druid.segment
Class IdMapping.Builder
- java.lang.Object
-
- org.apache.druid.segment.IdMapping.Builder
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddForwardMapping(int forwardId)Adds a lookup for the 'forwarded' index to the current highest index value.voidaddMapping(int forwardId)Adds a lookup for the 'forwarded' index to the current highest index value, and a reverse lookup from this substitute index back to the original.IdMappingbuild()static IdMapping.BuilderofCardinality(int cardinality)Create aIdMappingwhere the cardinality is known, to use withaddMapping(int)to simultaneously populate bothforwardMappingandreverseMapping.static IdMapping.BuilderofUnknownCardinality()Create anIdMappingwhere the cardinality is not known up front.
-
-
-
Method Detail
-
ofCardinality
public static IdMapping.Builder ofCardinality(int cardinality)
Create aIdMappingwhere the cardinality is known, to use withaddMapping(int)to simultaneously populate bothforwardMappingandreverseMapping.
-
ofUnknownCardinality
public static IdMapping.Builder ofUnknownCardinality()
Create anIdMappingwhere the cardinality is not known up front. Since cardinality is unknown,reverseMappingis initialized to an empty array, andaddForwardMapping(int)should be used to build theforwardMapping, whenbuild()is calledreverseMappingwill be computed to produce the completedIdMapping. This is less efficient thanofCardinality(int), so it should be preferred if the value cardinality is in fact known
-
addMapping
public void addMapping(int forwardId)
Adds a lookup for the 'forwarded' index to the current highest index value, and a reverse lookup from this substitute index back to the original. This method can only be called when cardinality is known, to ensure thatreverseMappingis initialized correctly.
-
addForwardMapping
public void addForwardMapping(int forwardId)
Adds a lookup for the 'forwarded' index to the current highest index value. This method can only be used when the cardinality is unknown, otherwiseaddMapping(int)should be used instead since thereverseMappingis only computed ifknownCardinalityis false
-
build
public IdMapping build()
-
-