Make LinearShardSpec require a partitionNum

This commit is contained in:
cheddar 2013-08-29 14:00:28 -05:00
parent 5ad023cd3f
commit 7834ffe6fc
1 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,8 @@
package com.metamx.druid.shard; package com.metamx.druid.shard;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import com.metamx.druid.input.InputRow; import com.metamx.druid.input.InputRow;
import com.metamx.druid.partition.LinearPartitionChunk; import com.metamx.druid.partition.LinearPartitionChunk;
import com.metamx.druid.partition.PartitionChunk; import com.metamx.druid.partition.PartitionChunk;
@ -10,12 +12,11 @@ import java.util.Map;
public class LinearShardSpec implements ShardSpec { public class LinearShardSpec implements ShardSpec {
private int partitionNum; private int partitionNum;
public LinearShardSpec() { @JsonCreator
this(-1); public LinearShardSpec(
} @JsonProperty("partitionNum") Integer partitionNum
) {
public LinearShardSpec(int partitionNum) { this.partitionNum = Preconditions.checkNotNull(partitionNum, "Must set partitionNum on LinearShardSpec");
this.partitionNum = partitionNum;
} }
@JsonProperty("partitionNum") @JsonProperty("partitionNum")