From 62eda5020c64de2cffe84cfbd967e932b5f27c95 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Tue, 1 Oct 2013 12:50:08 -0700 Subject: [PATCH] ShardSpec: Remove isInChunk(Map) --- .../indexing/common/task/IndexGeneratorTask.java | 14 +++----------- .../druid/timeline/partition/LinearShardSpec.java | 5 ----- .../timeline/partition/NumberedShardSpec.java | 6 ------ .../partition/SingleDimensionShardSpec.java | 6 ------ .../server/shard/SingleDimensionShardSpecTest.java | 1 - 5 files changed, 3 insertions(+), 29 deletions(-) diff --git a/indexing-service/src/main/java/io/druid/indexing/common/task/IndexGeneratorTask.java b/indexing-service/src/main/java/io/druid/indexing/common/task/IndexGeneratorTask.java index 480510a6e19..9c766e9ea48 100644 --- a/indexing-service/src/main/java/io/druid/indexing/common/task/IndexGeneratorTask.java +++ b/indexing-service/src/main/java/io/druid/indexing/common/task/IndexGeneratorTask.java @@ -210,19 +210,11 @@ public class IndexGeneratorTask extends AbstractTask */ private boolean shouldIndex(InputRow inputRow) { - if (!getImplicitLockInterval().get().contains(inputRow.getTimestampFromEpoch())) { + if (getImplicitLockInterval().get().contains(inputRow.getTimestampFromEpoch())) { + return schema.getShardSpec().isInChunk(inputRow); + } else { return false; } - - final Map eventDimensions = Maps.newHashMapWithExpectedSize(inputRow.getDimensions().size()); - for (final String dim : inputRow.getDimensions()) { - final List dimValues = inputRow.getDimension(dim); - if (dimValues.size() == 1) { - eventDimensions.put(dim, Iterables.getOnlyElement(dimValues)); - } - } - - return schema.getShardSpec().isInChunk(eventDimensions); } @JsonProperty("firehose") diff --git a/server/src/main/java/io/druid/timeline/partition/LinearShardSpec.java b/server/src/main/java/io/druid/timeline/partition/LinearShardSpec.java index 4dd8c1002a0..5b716b20a73 100644 --- a/server/src/main/java/io/druid/timeline/partition/LinearShardSpec.java +++ b/server/src/main/java/io/druid/timeline/partition/LinearShardSpec.java @@ -49,11 +49,6 @@ public class LinearShardSpec implements ShardSpec return new LinearPartitionChunk(partitionNum, obj); } - @Override - public boolean isInChunk(Map dimensions) { - return true; - } - @Override public boolean isInChunk(InputRow inputRow) { return true; diff --git a/server/src/main/java/io/druid/timeline/partition/NumberedShardSpec.java b/server/src/main/java/io/druid/timeline/partition/NumberedShardSpec.java index e0e09c9fa76..7c09787b5cc 100644 --- a/server/src/main/java/io/druid/timeline/partition/NumberedShardSpec.java +++ b/server/src/main/java/io/druid/timeline/partition/NumberedShardSpec.java @@ -66,12 +66,6 @@ public class NumberedShardSpec implements ShardSpec return NumberedPartitionChunk.make(partitionNum, partitions, obj); } - @Override - public boolean isInChunk(Map dimensions) - { - return true; - } - @Override public boolean isInChunk(InputRow inputRow) { diff --git a/server/src/main/java/io/druid/timeline/partition/SingleDimensionShardSpec.java b/server/src/main/java/io/druid/timeline/partition/SingleDimensionShardSpec.java index e6b41f5a62a..3cb3e5a72ba 100644 --- a/server/src/main/java/io/druid/timeline/partition/SingleDimensionShardSpec.java +++ b/server/src/main/java/io/druid/timeline/partition/SingleDimensionShardSpec.java @@ -105,12 +105,6 @@ public class SingleDimensionShardSpec implements ShardSpec return new StringPartitionChunk(start, end, partitionNum, obj); } - @Override - public boolean isInChunk(Map dimensions) - { - return checkValue(dimensions.get(dimension)); - } - @Override public boolean isInChunk(InputRow inputRow) { diff --git a/server/src/test/java/io/druid/server/shard/SingleDimensionShardSpecTest.java b/server/src/test/java/io/druid/server/shard/SingleDimensionShardSpecTest.java index e262bab1f98..d07b52d9fcb 100644 --- a/server/src/test/java/io/druid/server/shard/SingleDimensionShardSpecTest.java +++ b/server/src/test/java/io/druid/server/shard/SingleDimensionShardSpecTest.java @@ -111,7 +111,6 @@ public class SingleDimensionShardSpecTest } ) ); - Assert.assertEquals(String.format("spec[%s], map[%s]", spec, pair.rhs), pair.lhs, spec.isInChunk(pair.rhs)); Assert.assertEquals(String.format("spec[%s], row[%s]", spec, inputRow), pair.lhs, spec.isInChunk(inputRow)); } }