fix broken UT

This commit is contained in:
fjy 2014-05-05 16:13:01 -07:00
parent b1bd6eb0f2
commit a747ed0011
1 changed files with 11 additions and 13 deletions

View File

@ -21,7 +21,6 @@ package io.druid.query.aggregation.cardinality;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
@ -30,9 +29,8 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import io.druid.query.aggregation.Aggregator; import io.druid.query.aggregation.Aggregator;
import io.druid.query.aggregation.AggregatorFactory; import io.druid.query.aggregation.AggregatorFactory;
import io.druid.query.aggregation.Aggregators;
import io.druid.query.aggregation.BufferAggregator; import io.druid.query.aggregation.BufferAggregator;
import io.druid.query.aggregation.NoopAggregator;
import io.druid.query.aggregation.NoopBufferAggregator;
import io.druid.query.aggregation.hyperloglog.HyperLogLogCollector; import io.druid.query.aggregation.hyperloglog.HyperLogLogCollector;
import io.druid.segment.ColumnSelectorFactory; import io.druid.segment.ColumnSelectorFactory;
import io.druid.segment.DimensionSelector; import io.druid.segment.DimensionSelector;
@ -78,7 +76,7 @@ public class CardinalityAggregatorFactory implements AggregatorFactory
List<DimensionSelector> selectors = makeDimensionSelectors(columnFactory); List<DimensionSelector> selectors = makeDimensionSelectors(columnFactory);
if (selectors.isEmpty()) { if (selectors.isEmpty()) {
return new NoopAggregator(name); return Aggregators.noopAggregator();
} }
return new CardinalityAggregator(name, selectors, byRow); return new CardinalityAggregator(name, selectors, byRow);
@ -91,7 +89,7 @@ public class CardinalityAggregatorFactory implements AggregatorFactory
List<DimensionSelector> selectors = makeDimensionSelectors(columnFactory); List<DimensionSelector> selectors = makeDimensionSelectors(columnFactory);
if (selectors.isEmpty()) { if (selectors.isEmpty()) {
return new NoopBufferAggregator(); return Aggregators.noopBufferAggregator();
} }
return new CardinalityBufferAggregator(selectors, byRow); return new CardinalityBufferAggregator(selectors, byRow);
@ -103,14 +101,14 @@ public class CardinalityAggregatorFactory implements AggregatorFactory
Iterables.filter( Iterables.filter(
Iterables.transform( Iterables.transform(
fieldNames, new Function<String, DimensionSelector>() fieldNames, new Function<String, DimensionSelector>()
{ {
@Nullable @Nullable
@Override @Override
public DimensionSelector apply(@Nullable String input) public DimensionSelector apply(@Nullable String input)
{ {
return columnFactory.makeDimensionSelector(input); return columnFactory.makeDimensionSelector(input);
} }
} }
), Predicates.notNull() ), Predicates.notNull()
) )
); );