From 7834ffe6fc4d0fde325fae57b5ba52bd548cc98c Mon Sep 17 00:00:00 2001 From: cheddar Date: Thu, 29 Aug 2013 14:00:28 -0500 Subject: [PATCH] Make LinearShardSpec require a partitionNum --- .../com/metamx/druid/shard/LinearShardSpec.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/src/main/java/com/metamx/druid/shard/LinearShardSpec.java b/client/src/main/java/com/metamx/druid/shard/LinearShardSpec.java index 4d77a19086d..3a3e6f0aa94 100644 --- a/client/src/main/java/com/metamx/druid/shard/LinearShardSpec.java +++ b/client/src/main/java/com/metamx/druid/shard/LinearShardSpec.java @@ -1,6 +1,8 @@ package com.metamx.druid.shard; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.Preconditions; import com.metamx.druid.input.InputRow; import com.metamx.druid.partition.LinearPartitionChunk; import com.metamx.druid.partition.PartitionChunk; @@ -10,12 +12,11 @@ import java.util.Map; public class LinearShardSpec implements ShardSpec { private int partitionNum; - public LinearShardSpec() { - this(-1); - } - - public LinearShardSpec(int partitionNum) { - this.partitionNum = partitionNum; + @JsonCreator + public LinearShardSpec( + @JsonProperty("partitionNum") Integer partitionNum + ) { + this.partitionNum = Preconditions.checkNotNull(partitionNum, "Must set partitionNum on LinearShardSpec"); } @JsonProperty("partitionNum")