Class HashBasedNumberedShardSpec
- java.lang.Object
-
- org.apache.druid.timeline.partition.NumberedShardSpec
-
- org.apache.druid.timeline.partition.HashBasedNumberedShardSpec
-
- All Implemented Interfaces:
ShardSpec
public class HashBasedNumberedShardSpec extends NumberedShardSpec
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.druid.timeline.partition.ShardSpec
ShardSpec.Type
-
-
Field Summary
Fields Modifier and Type Field Description static List<String>DEFAULT_PARTITION_DIMENSIONS
-
Constructor Summary
Constructors Constructor Description HashBasedNumberedShardSpec(int partitionNum, int partitions, Integer bucketId, Integer numBuckets, List<String> partitionDimensions, HashPartitionFunction partitionFunction, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)intgetBucketId()List<String>getDomainDimensions()Get dimensions who have possible range for the rows this shard contains.ShardSpecLookupgetLookup(List<? extends ShardSpec> shardSpecs)intgetNumBuckets()List<String>getPartitionDimensions()HashPartitionFunctiongetPartitionFunction()StringgetType()Get the type name of this ShardSpec.inthashCode()booleanpossibleInDomain(Map<String,com.google.common.collect.RangeSet<String>> domain)if given domain ranges are not possible in this shard, return false; otherwise return true;static byte[]serializeGroupKey(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, List<Object> partitionKeys)Serializes a group key into a byte array.StringtoString()-
Methods inherited from class org.apache.druid.timeline.partition.NumberedShardSpec
createChunk, getNumCorePartitions, getPartitionNum
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.druid.timeline.partition.ShardSpec
getAtomicUpdateGroupSize, getEndRootPartitionId, getMinorVersion, getStartRootPartitionId, sharePartitionSpace
-
-
-
-
Constructor Detail
-
HashBasedNumberedShardSpec
public HashBasedNumberedShardSpec(int partitionNum, int partitions, @Nullable Integer bucketId, @Nullable Integer numBuckets, @Nullable List<String> partitionDimensions, @Nullable HashPartitionFunction partitionFunction, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
-
-
Method Detail
-
getBucketId
public int getBucketId()
-
getNumBuckets
public int getNumBuckets()
-
getPartitionFunction
@Nullable public HashPartitionFunction getPartitionFunction()
-
getDomainDimensions
public List<String> getDomainDimensions()
Description copied from interface:ShardSpecGet dimensions who have possible range for the rows this shard contains.- Specified by:
getDomainDimensionsin interfaceShardSpec- Overrides:
getDomainDimensionsin classNumberedShardSpec- Returns:
- list of dimensions who has its possible range. Dimensions with unknown possible range are not listed
-
getLookup
public ShardSpecLookup getLookup(List<? extends ShardSpec> shardSpecs)
- Specified by:
getLookupin interfaceShardSpec- Overrides:
getLookupin classNumberedShardSpec
-
possibleInDomain
public boolean possibleInDomain(Map<String,com.google.common.collect.RangeSet<String>> domain)
Description copied from interface:ShardSpecif given domain ranges are not possible in this shard, return false; otherwise return true;- Specified by:
possibleInDomainin interfaceShardSpec- Overrides:
possibleInDomainin classNumberedShardSpec- Returns:
- possibility of in domain
-
serializeGroupKey
public static byte[] serializeGroupKey(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, List<Object> partitionKeys)Serializes a group key into a byte array. The serialization algorithm can affect hash values of partition keys sinceHashPartitionFunction.hash(byte[], int)takes the result of this method as its input. This means, the returned byte array should be backwards-compatible in cases where we need to modify this method.
-
getType
public String getType()
Description copied from interface:ShardSpecGet the type name of this ShardSpec.- Specified by:
getTypein interfaceShardSpec- Overrides:
getTypein classNumberedShardSpec
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classNumberedShardSpec
-
hashCode
public int hashCode()
- Overrides:
hashCodein classNumberedShardSpec
-
toString
public String toString()
- Overrides:
toStringin classNumberedShardSpec
-
-