make valueType configurable

This commit is contained in:
nishantmonu51 2014-08-13 14:37:57 +05:30
parent 03d7ec04be
commit 6f60a3f604
34 changed files with 135 additions and 118 deletions

View File

@ -19,7 +19,6 @@
package io.druid.indexing.common.task;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.InjectableValues;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -104,7 +103,7 @@ public class TaskSerdeTest
DataSegment.builder().dataSource("foo").interval(new Interval("2010-01-01/P1D")).version("1234").build()
),
ImmutableList.<AggregatorFactory>of(
new CountAggregatorFactory("cnt")
new CountAggregatorFactory("cnt", null)
)
);

View File

@ -35,16 +35,22 @@ import java.util.List;
public class CountAggregatorFactory implements AggregatorFactory
{
private static final byte[] CACHE_KEY = new byte[]{0x0};
private static final String DEFAULT_VALUE_TYPE = "long";
private static final List<String> supportedTypes = Arrays.asList("float", "long");
private final String name;
private final String valueType;
@JsonCreator
public CountAggregatorFactory(
@JsonProperty("name") String name
@JsonProperty("name") String name,
@JsonProperty("valueType") String valueType
)
{
Preconditions.checkNotNull(name, "Must have a valid, non-null aggregator name");
this.name = name;
this.valueType = valueType == null ? DEFAULT_VALUE_TYPE : valueType;
Preconditions.checkArgument(supportedTypes.contains(this.valueType));
}
@Override
@ -74,13 +80,13 @@ public class CountAggregatorFactory implements AggregatorFactory
@Override
public AggregatorFactory getCombiningFactory()
{
return new LongSumAggregatorFactory(name, name);
return new LongSumAggregatorFactory(name, name, valueType);
}
@Override
public List<AggregatorFactory> getRequiredColumns()
{
return Arrays.<AggregatorFactory>asList(new CountAggregatorFactory(name));
return Arrays.<AggregatorFactory>asList(new CountAggregatorFactory(name, valueType));
}
@Override
@ -117,7 +123,7 @@ public class CountAggregatorFactory implements AggregatorFactory
@Override
public String getTypeName()
{
return "float";
return "long";
}
@Override

View File

@ -35,14 +35,18 @@ import java.util.List;
public class LongSumAggregatorFactory implements AggregatorFactory
{
private static final byte CACHE_TYPE_ID = 0x1;
private static final String DEFAULT_VALUE_TYPE = "long";
private static final List<String> supportedTypes = Arrays.asList("float", "long");
private final String fieldName;
private final String name;
private final String valueType;
@JsonCreator
public LongSumAggregatorFactory(
@JsonProperty("name") String name,
@JsonProperty("fieldName") final String fieldName
@JsonProperty("fieldName") final String fieldName,
@JsonProperty("valueType") String valueType
)
{
Preconditions.checkNotNull(name, "Must have a valid, non-null aggregator name");
@ -50,6 +54,8 @@ public class LongSumAggregatorFactory implements AggregatorFactory
this.name = name;
this.fieldName = fieldName;
this.valueType = valueType == null ? DEFAULT_VALUE_TYPE : valueType;
Preconditions.checkArgument(supportedTypes.contains(this.valueType));
}
@Override
@ -82,13 +88,13 @@ public class LongSumAggregatorFactory implements AggregatorFactory
@Override
public AggregatorFactory getCombiningFactory()
{
return new LongSumAggregatorFactory(name, name);
return new LongSumAggregatorFactory(name, name, valueType);
}
@Override
public List<AggregatorFactory> getRequiredColumns()
{
return Arrays.<AggregatorFactory>asList(new LongSumAggregatorFactory(fieldName, fieldName));
return Arrays.<AggregatorFactory>asList(new LongSumAggregatorFactory(fieldName, fieldName, valueType));
}
@Override

View File

@ -107,7 +107,7 @@ public class ChainedExecutionQueryRunnerTest
Druids.newTimeseriesQueryBuilder()
.dataSource("test")
.intervals("2014/2015")
.aggregators(Lists.<AggregatorFactory>newArrayList(new CountAggregatorFactory("count")))
.aggregators(Lists.<AggregatorFactory>newArrayList(new CountAggregatorFactory("count", null)))
.build(),
context
);
@ -215,7 +215,7 @@ public class ChainedExecutionQueryRunnerTest
Druids.newTimeseriesQueryBuilder()
.dataSource("test")
.intervals("2014/2015")
.aggregators(Lists.<AggregatorFactory>newArrayList(new CountAggregatorFactory("count")))
.aggregators(Lists.<AggregatorFactory>newArrayList(new CountAggregatorFactory("count", null)))
.context(ImmutableMap.<String, Object>of("timeout", 100, "queryId", "test"))
.build(),
context

View File

@ -73,7 +73,7 @@ public class DataSourceTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(QueryRunnerTestHelper.dayGran)

View File

@ -40,7 +40,7 @@ public class QueriesTest
public void testVerifyAggregations() throws Exception
{
List<AggregatorFactory> aggFactories = Arrays.<AggregatorFactory>asList(
new CountAggregatorFactory("count"),
new CountAggregatorFactory("count", null),
new DoubleSumAggregatorFactory("idx", "index"),
new DoubleSumAggregatorFactory("rev", "revenue")
);
@ -72,7 +72,7 @@ public class QueriesTest
public void testVerifyAggregationsMissingVal() throws Exception
{
List<AggregatorFactory> aggFactories = Arrays.<AggregatorFactory>asList(
new CountAggregatorFactory("count"),
new CountAggregatorFactory("count", null),
new DoubleSumAggregatorFactory("idx", "index"),
new DoubleSumAggregatorFactory("rev", "revenue")
);
@ -104,7 +104,7 @@ public class QueriesTest
public void testVerifyAggregationsMultiLevel() throws Exception
{
List<AggregatorFactory> aggFactories = Arrays.<AggregatorFactory>asList(
new CountAggregatorFactory("count"),
new CountAggregatorFactory("count", null),
new DoubleSumAggregatorFactory("idx", "index"),
new DoubleSumAggregatorFactory("rev", "revenue")
);
@ -158,7 +158,7 @@ public class QueriesTest
public void testVerifyAggregationsMultiLevelMissingVal() throws Exception
{
List<AggregatorFactory> aggFactories = Arrays.<AggregatorFactory>asList(
new CountAggregatorFactory("count"),
new CountAggregatorFactory("count", null),
new DoubleSumAggregatorFactory("idx", "index"),
new DoubleSumAggregatorFactory("rev", "revenue")
);

View File

@ -90,8 +90,8 @@ public class QueryRunnerTestHelper
public static final String uniqueMetric = "uniques";
public static final String addRowsIndexConstantMetric = "addRowsIndexConstant";
public static String dependentPostAggMetric = "dependentPostAgg";
public static final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows");
public static final LongSumAggregatorFactory indexLongSum = new LongSumAggregatorFactory("index", "index");
public static final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows", null);
public static final LongSumAggregatorFactory indexLongSum = new LongSumAggregatorFactory("index", "index", null);
public static final DoubleSumAggregatorFactory indexDoubleSum = new DoubleSumAggregatorFactory("index", "index");
public static final JavaScriptAggregatorFactory jsIndexSumIfPlacementishA = new JavaScriptAggregatorFactory(
"nindex",

View File

@ -36,7 +36,8 @@ public class RetryQueryRunnerTest
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory(
"idx",
"index"
"index",
null
),
QueryRunnerTestHelper.qualityUniques
)

View File

@ -56,7 +56,7 @@ public class CountAggregatorTest
Object first = agg.get();
agg.aggregate();
Comparator comp = new CountAggregatorFactory("null").getComparator();
Comparator comp = new CountAggregatorFactory("null", null).getComparator();
Assert.assertEquals(-1, comp.compare(first, agg.get()));
Assert.assertEquals(0, comp.compare(first, first));

View File

@ -66,7 +66,7 @@ public class LongSumAggregatorTest
Object first = agg.get();
agg.aggregate();
Comparator comp = new LongSumAggregatorFactory("null", "null").getComparator();
Comparator comp = new LongSumAggregatorFactory("null", "null", null).getComparator();
Assert.assertEquals(-1, comp.compare(first, agg.get()));
Assert.assertEquals(0, comp.compare(first, first));

View File

@ -191,7 +191,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(QueryRunnerTestHelper.dayGran)
@ -302,7 +302,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(QueryRunnerTestHelper.dayGran)
@ -353,7 +353,8 @@ public class GroupByQueryRunnerTest
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory(
"idx",
"index"
"index",
null
)
)
)
@ -403,7 +404,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(new PeriodGranularity(new Period("P1M"), null, null));
@ -479,7 +480,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(new PeriodGranularity(new Period("P1M"), null, null))
@ -517,7 +518,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(new PeriodGranularity(new Period("P1M"), null, null))
@ -596,7 +597,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(new PeriodGranularity(new Period("P1M"), null, null))
@ -636,7 +637,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.addOrderByColumn("rows")
@ -677,7 +678,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.addOrderByColumn("rows", "desc")
@ -763,7 +764,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(new PeriodGranularity(new Period("P1M"), null, null))
@ -954,7 +955,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(QueryRunnerTestHelper.dayGran)
@ -967,8 +968,8 @@ public class GroupByQueryRunnerTest
.setDimensions(Lists.<DimensionSpec>newArrayList(new DefaultDimensionSpec("alias", "alias")))
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
new LongSumAggregatorFactory("rows", "rows"),
new LongSumAggregatorFactory("idx", "idx")
new LongSumAggregatorFactory("rows", "rows", null),
new LongSumAggregatorFactory("idx", "idx", null)
)
)
.setGranularity(QueryRunnerTestHelper.dayGran)
@ -1012,7 +1013,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(QueryRunnerTestHelper.dayGran)
@ -1050,7 +1051,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(QueryRunnerTestHelper.dayGran)
@ -1087,7 +1088,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(QueryRunnerTestHelper.dayGran)
@ -1121,7 +1122,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx_subagg", "index")
new LongSumAggregatorFactory("idx_subagg", "index", null)
)
)
.setPostAggregatorSpecs(
@ -1145,8 +1146,8 @@ public class GroupByQueryRunnerTest
.setDimensions(Lists.<DimensionSpec>newArrayList(new DefaultDimensionSpec("alias", "alias")))
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
new LongSumAggregatorFactory("rows", "rows"),
new LongSumAggregatorFactory("idx", "idx_subpostagg")
new LongSumAggregatorFactory("rows", "rows", null),
new LongSumAggregatorFactory("idx", "idx_subpostagg", null)
)
)
.setPostAggregatorSpecs(
@ -1202,7 +1203,7 @@ public class GroupByQueryRunnerTest
.setAggregatorSpecs(
Arrays.asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx_subagg", "index")
new LongSumAggregatorFactory("idx_subagg", "index", null)
)
)
.setPostAggregatorSpecs(
@ -1245,8 +1246,8 @@ public class GroupByQueryRunnerTest
.setDimensions(Lists.<DimensionSpec>newArrayList(new DefaultDimensionSpec("alias", "alias")))
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
new LongSumAggregatorFactory("rows", "rows"),
new LongSumAggregatorFactory("idx", "idx_subpostagg")
new LongSumAggregatorFactory("rows", "rows", null),
new LongSumAggregatorFactory("idx", "idx_subpostagg", null)
)
)
.setPostAggregatorSpecs(
@ -1350,8 +1351,8 @@ public class GroupByQueryRunnerTest
.setDimensions(Lists.<DimensionSpec>newArrayList(new DefaultDimensionSpec("alias", "alias")))
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
new LongSumAggregatorFactory("rows", "rows"),
new LongSumAggregatorFactory("idx", "idx_subpostagg"),
new LongSumAggregatorFactory("rows", "rows", null),
new LongSumAggregatorFactory("idx", "idx_subpostagg", null),
new DoubleSumAggregatorFactory("js_outer_agg", "js_agg")
)
)

View File

@ -24,12 +24,10 @@ package io.druid.query.groupby;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import io.druid.jackson.DefaultObjectMapper;
import io.druid.query.Druids;
import io.druid.query.Query;
import io.druid.query.QueryRunnerTestHelper;
import io.druid.query.aggregation.AggregatorFactory;
import io.druid.query.aggregation.LongSumAggregatorFactory;
import io.druid.query.aggregation.PostAggregator;
import io.druid.query.dimension.DefaultDimensionSpec;
import io.druid.query.dimension.DimensionSpec;
import org.junit.Assert;
@ -53,7 +51,7 @@ public class GroupByQueryTest
.setAggregatorSpecs(
Arrays.<AggregatorFactory>asList(
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory("idx", "index")
new LongSumAggregatorFactory("idx", "index", null)
)
)
.setGranularity(QueryRunnerTestHelper.dayGran)

View File

@ -77,7 +77,8 @@ public class TimeSeriesUnionQueryRunnerTest
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory(
"idx",
"index"
"index",
null
),
QueryRunnerTestHelper.qualityUniques
)

View File

@ -36,8 +36,8 @@ import java.util.List;
*/
public class TimeseriesBinaryFnTest
{
final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows");
final LongSumAggregatorFactory indexLongSum = new LongSumAggregatorFactory("index", "index");
final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows", null);
final LongSumAggregatorFactory indexLongSum = new LongSumAggregatorFactory("index", "index", null);
final List<AggregatorFactory> aggregatorFactories = Arrays.asList(
rowsCount,
indexLongSum

View File

@ -109,7 +109,7 @@ public class TimeseriesQueryRunnerBonusTest
.intervals(ImmutableList.of(new Interval("2012-01-01T00:00:00Z/P1D")))
.aggregators(
ImmutableList.<AggregatorFactory>of(
new CountAggregatorFactory("rows")
new CountAggregatorFactory("rows", null)
)
)
.build();

View File

@ -260,7 +260,8 @@ public class TimeseriesQueryRunnerTest
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory(
"idx",
"index"
"index",
null
),
QueryRunnerTestHelper.qualityUniques
)
@ -301,7 +302,8 @@ public class TimeseriesQueryRunnerTest
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory(
"idx",
"index"
"index",
null
)
)
)
@ -355,7 +357,8 @@ public class TimeseriesQueryRunnerTest
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory(
"idx",
"index"
"index",
null
),
QueryRunnerTestHelper.qualityUniques
)
@ -392,7 +395,8 @@ public class TimeseriesQueryRunnerTest
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory(
"idx",
"index"
"index",
null
),
QueryRunnerTestHelper.qualityUniques
)
@ -440,7 +444,8 @@ public class TimeseriesQueryRunnerTest
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory(
"idx",
"index"
"index",
null
)
)
)
@ -487,7 +492,8 @@ public class TimeseriesQueryRunnerTest
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory(
"idx",
"index"
"index",
null
),
QueryRunnerTestHelper.qualityUniques
)
@ -525,7 +531,8 @@ public class TimeseriesQueryRunnerTest
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory(
"idx",
"index"
"index",
null
),
QueryRunnerTestHelper.qualityUniques
)
@ -568,7 +575,8 @@ public class TimeseriesQueryRunnerTest
QueryRunnerTestHelper.rowsCount,
new LongSumAggregatorFactory(
"idx",
"index"
"index",
null
)
)
)

View File

@ -67,10 +67,10 @@ public class TopNBinaryFnBenchmark extends SimpleBenchmark
final List<AggregatorFactory> aggregatorFactories = new ArrayList<>();
aggregatorFactories.add(new CountAggregatorFactory("rows"));
aggregatorFactories.add(new LongSumAggregatorFactory("index", "index"));
aggregatorFactories.add(new CountAggregatorFactory("rows", null));
aggregatorFactories.add(new LongSumAggregatorFactory("index", "index", null));
for (int i = 1; i < aggCount; i++) {
aggregatorFactories.add(new CountAggregatorFactory("rows" + i));
aggregatorFactories.add(new CountAggregatorFactory("rows" + i, null));
}
final List<PostAggregator> postAggregators = new ArrayList<>();
for (int i = 0; i < postAggCount; i++) {

View File

@ -45,8 +45,8 @@ import java.util.Map;
*/
public class TopNBinaryFnTest
{
final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows");
final LongSumAggregatorFactory indexLongSum = new LongSumAggregatorFactory("index", "index");
final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows", null);
final LongSumAggregatorFactory indexLongSum = new LongSumAggregatorFactory("index", "index", null);
final ConstantPostAggregator constant = new ConstantPostAggregator("const", 1L, null);
final FieldAccessPostAggregator rowsPostAgg = new FieldAccessPostAggregator("rows", "rows");
final FieldAccessPostAggregator indexPostAgg = new FieldAccessPostAggregator("index", "index");

View File

@ -69,12 +69,12 @@ public class AppendTest
{
private static final AggregatorFactory[] METRIC_AGGS = new AggregatorFactory[]{
new DoubleSumAggregatorFactory("index", "index"),
new CountAggregatorFactory("count"),
new CountAggregatorFactory("count", null),
new HyperUniquesAggregatorFactory("quality_uniques", "quality")
};
private static final AggregatorFactory[] METRIC_AGGS_NO_UNIQ = new AggregatorFactory[]{
new DoubleSumAggregatorFactory("index", "index"),
new CountAggregatorFactory("count")
new CountAggregatorFactory("count", null)
};
final String dataSource = "testing";
@ -86,7 +86,7 @@ public class AppendTest
final String placementDimension = "placement";
final String placementishDimension = "placementish";
final String indexMetric = "index";
final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows");
final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows", null);
final DoubleSumAggregatorFactory indexDoubleSum = new DoubleSumAggregatorFactory("index", "index");
final HyperUniquesAggregatorFactory uniques = new HyperUniquesAggregatorFactory("uniques", "quality_uniques");
final ConstantPostAggregator constant = new ConstantPostAggregator("const", 1L, null);

View File

@ -68,12 +68,12 @@ public class SchemalessIndex
private static final List<String> METRICS = Arrays.asList("index");
private static final AggregatorFactory[] METRIC_AGGS = new AggregatorFactory[]{
new DoubleSumAggregatorFactory("index", "index"),
new CountAggregatorFactory("count"),
new CountAggregatorFactory("count", null),
new HyperUniquesAggregatorFactory("quality_uniques", "quality")
};
private static final AggregatorFactory[] METRIC_AGGS_NO_UNIQ = new AggregatorFactory[]{
new DoubleSumAggregatorFactory("index", "index"),
new CountAggregatorFactory("count")
new CountAggregatorFactory("count", null)
};
private static final List<Map<String, Object>> events = Lists.newArrayList();

View File

@ -76,7 +76,7 @@ public class SchemalessTestFull
final String placementDimension = "placement";
final String placementishDimension = "placementish";
final String indexMetric = "index";
final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows");
final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows", null);
final DoubleSumAggregatorFactory indexDoubleSum = new DoubleSumAggregatorFactory("index", "index");
final HyperUniquesAggregatorFactory uniques = new HyperUniquesAggregatorFactory("uniques", "quality_uniques");
final ConstantPostAggregator constant = new ConstantPostAggregator("const", 1L, null);

View File

@ -103,7 +103,7 @@ public class SchemalessTestSimple
final String placementDimension = "placement";
final String placementishDimension = "placementish";
final String indexMetric = "index";
final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows");
final CountAggregatorFactory rowsCount = new CountAggregatorFactory("rows", null);
final DoubleSumAggregatorFactory indexDoubleSum = new DoubleSumAggregatorFactory("index", "index");
final HyperUniquesAggregatorFactory uniques = new HyperUniquesAggregatorFactory("uniques", "quality_uniques");
final ConstantPostAggregator constant = new ConstantPostAggregator("const", 1L, null);

View File

@ -109,7 +109,7 @@ public class IncrementalIndexTest
final IncrementalIndex index = new IncrementalIndex(
0L,
QueryGranularity.NONE,
new AggregatorFactory[]{new CountAggregatorFactory("count")},
new AggregatorFactory[]{new CountAggregatorFactory("count", null)},
TestQueryRunners.pool
);
final int threadCount = 10;

View File

@ -51,7 +51,6 @@ import io.druid.segment.QueryableIndex;
import io.druid.segment.QueryableIndexSegment;
import io.druid.segment.Segment;
import io.druid.segment.TestHelper;
import io.druid.segment.column.ColumnConfig;
import io.druid.segment.incremental.IncrementalIndex;
import io.druid.segment.incremental.IncrementalIndexSchema;
import org.joda.time.DateTime;
@ -75,8 +74,8 @@ public class SpatialFilterBonusTest
{
private static Interval DATA_INTERVAL = new Interval("2013-01-01/2013-01-07");
private static AggregatorFactory[] METRIC_AGGS = new AggregatorFactory[]{
new CountAggregatorFactory("rows"),
new LongSumAggregatorFactory("val", "val")
new CountAggregatorFactory("rows", null),
new LongSumAggregatorFactory("val", "val", null)
};
private static List<String> DIMS = Lists.newArrayList("dim", "dim.geo");
private final Segment segment;
@ -445,8 +444,8 @@ public class SpatialFilterBonusTest
)
.aggregators(
Arrays.<AggregatorFactory>asList(
new CountAggregatorFactory("rows"),
new LongSumAggregatorFactory("val", "val")
new CountAggregatorFactory("rows", null),
new LongSumAggregatorFactory("val", "val", null)
)
)
.build();
@ -496,8 +495,8 @@ public class SpatialFilterBonusTest
)
.aggregators(
Arrays.<AggregatorFactory>asList(
new CountAggregatorFactory("rows"),
new LongSumAggregatorFactory("val", "val")
new CountAggregatorFactory("rows", null),
new LongSumAggregatorFactory("val", "val", null)
)
)
.build();

View File

@ -51,7 +51,6 @@ import io.druid.segment.QueryableIndex;
import io.druid.segment.QueryableIndexSegment;
import io.druid.segment.Segment;
import io.druid.segment.TestHelper;
import io.druid.segment.column.ColumnConfig;
import io.druid.segment.incremental.IncrementalIndex;
import io.druid.segment.incremental.IncrementalIndexSchema;
import org.joda.time.DateTime;
@ -75,8 +74,8 @@ public class SpatialFilterTest
{
private static Interval DATA_INTERVAL = new Interval("2013-01-01/2013-01-07");
private static AggregatorFactory[] METRIC_AGGS = new AggregatorFactory[]{
new CountAggregatorFactory("rows"),
new LongSumAggregatorFactory("val", "val")
new CountAggregatorFactory("rows", null),
new LongSumAggregatorFactory("val", "val", null)
};
private static List<String> DIMS = Lists.newArrayList("dim", "lat", "long");
private final Segment segment;
@ -473,8 +472,8 @@ public class SpatialFilterTest
)
.aggregators(
Arrays.asList(
new CountAggregatorFactory("rows"),
new LongSumAggregatorFactory("val", "val")
new CountAggregatorFactory("rows", null),
new LongSumAggregatorFactory("val", "val", null)
)
)
.build();
@ -524,8 +523,8 @@ public class SpatialFilterTest
)
.aggregators(
Arrays.asList(
new CountAggregatorFactory("rows"),
new LongSumAggregatorFactory("val", "val")
new CountAggregatorFactory("rows", null),
new LongSumAggregatorFactory("val", "val", null)
)
)
.build();

View File

@ -53,7 +53,6 @@ import org.junit.Test;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
/**
*/
@ -63,7 +62,7 @@ public class IncrementalIndexStorageAdapterTest
public void testSanity() throws Exception
{
IncrementalIndex index = new IncrementalIndex(
0, QueryGranularity.MINUTE, new AggregatorFactory[]{new CountAggregatorFactory("cnt")},
0, QueryGranularity.MINUTE, new AggregatorFactory[]{new CountAggregatorFactory("cnt", null)},
TestQueryRunners.pool
);
@ -110,7 +109,7 @@ public class IncrementalIndexStorageAdapterTest
.setInterval(new Interval(0, new DateTime().getMillis()))
.addDimension("billy")
.addDimension("sally")
.addAggregator(new LongSumAggregatorFactory("cnt", "cnt"))
.addAggregator(new LongSumAggregatorFactory("cnt", "cnt", null))
.build(),
new IncrementalIndexStorageAdapter(index)
);
@ -129,7 +128,7 @@ public class IncrementalIndexStorageAdapterTest
@Test
public void testResetSanity() {
IncrementalIndex index = new IncrementalIndex(
0, QueryGranularity.MINUTE, new AggregatorFactory[]{new CountAggregatorFactory("cnt")},
0, QueryGranularity.MINUTE, new AggregatorFactory[]{new CountAggregatorFactory("cnt", null)},
TestQueryRunners.pool
);
@ -182,7 +181,7 @@ public class IncrementalIndexStorageAdapterTest
public void testSingleValueTopN()
{
IncrementalIndex index = new IncrementalIndex(
0, QueryGranularity.MINUTE, new AggregatorFactory[]{new CountAggregatorFactory("cnt")},
0, QueryGranularity.MINUTE, new AggregatorFactory[]{new CountAggregatorFactory("cnt", null)},
TestQueryRunners.pool
);
@ -220,7 +219,8 @@ public class IncrementalIndexStorageAdapterTest
Lists.<AggregatorFactory>newArrayList(
new LongSumAggregatorFactory(
"cnt",
"cnt"
"cnt",
null
)
)
)
@ -238,7 +238,7 @@ public class IncrementalIndexStorageAdapterTest
public void testFilterByNull() throws Exception
{
IncrementalIndex index = new IncrementalIndex(
0, QueryGranularity.MINUTE, new AggregatorFactory[]{new CountAggregatorFactory("cnt")},
0, QueryGranularity.MINUTE, new AggregatorFactory[]{new CountAggregatorFactory("cnt", null)},
TestQueryRunners.pool
);
@ -285,7 +285,7 @@ public class IncrementalIndexStorageAdapterTest
.setInterval(new Interval(0, new DateTime().getMillis()))
.addDimension("billy")
.addDimension("sally")
.addAggregator(new LongSumAggregatorFactory("cnt", "cnt"))
.addAggregator(new LongSumAggregatorFactory("cnt", "cnt", null))
.setDimFilter(DimFilters.dimEquals("sally", (String) null))
.build(),
new IncrementalIndexStorageAdapter(index)

View File

@ -72,7 +72,7 @@ import java.util.Map;
case SUM: return new DoubleSumAggregatorFactory("sum("+name+")", name);
case MIN: return new MinAggregatorFactory("min("+name+")", name);
case MAX: return new MaxAggregatorFactory("max("+name+")", name);
case COUNT: return new CountAggregatorFactory(name);
case COUNT: return new CountAggregatorFactory(name, null);
}
throw new IllegalArgumentException("Unknown function [" + fn + "]");
}

View File

@ -150,9 +150,9 @@ public class CachingClusteredClientTest
*/
private static final int RANDOMNESS = 10;
private static final List<AggregatorFactory> AGGS = Arrays.asList(
new CountAggregatorFactory("rows"),
new LongSumAggregatorFactory("imps", "imps"),
new LongSumAggregatorFactory("impers", "imps")
new CountAggregatorFactory("rows", null),
new LongSumAggregatorFactory("imps", "imps", null),
new LongSumAggregatorFactory("impers", "imps", null)
);
private static final List<PostAggregator> POST_AGGS = Arrays.<PostAggregator>asList(
new ArithmeticPostAggregator(
@ -181,9 +181,9 @@ public class CachingClusteredClientTest
)
);
private static final List<AggregatorFactory> RENAMED_AGGS = Arrays.asList(
new CountAggregatorFactory("rows2"),
new LongSumAggregatorFactory("imps", "imps"),
new LongSumAggregatorFactory("impers2", "imps")
new CountAggregatorFactory("rows2", null),
new LongSumAggregatorFactory("imps", "imps", null),
new LongSumAggregatorFactory("impers2", "imps", null)
);
private static final DimFilter DIM_FILTER = null;
private static final List<PostAggregator> RENAMED_POST_AGGS = Arrays.asList();

View File

@ -66,9 +66,9 @@ public class CachingQueryRunnerTest
{
private static final List<AggregatorFactory> AGGS = Arrays.asList(
new CountAggregatorFactory("rows"),
new LongSumAggregatorFactory("imps", "imps"),
new LongSumAggregatorFactory("impers", "imps")
new CountAggregatorFactory("rows", null),
new LongSumAggregatorFactory("imps", "imps", null),
new LongSumAggregatorFactory("impers", "imps", null)
);
private static final Object[] objects = new Object[]{

View File

@ -66,7 +66,7 @@ public class FireDepartmentTest
null, null, null, null
),
new AggregatorFactory[]{
new CountAggregatorFactory("count")
new CountAggregatorFactory("count", null)
},
new UniformGranularitySpec(Granularity.HOUR, QueryGranularity.MINUTE, null, Granularity.HOUR)
),

View File

@ -73,7 +73,7 @@ public class RealtimeManagerTest
schema = new DataSchema(
"test",
null,
new AggregatorFactory[]{new CountAggregatorFactory("rows")},
new AggregatorFactory[]{new CountAggregatorFactory("rows", null)},
new UniformGranularitySpec(Granularity.HOUR, QueryGranularity.NONE, null, Granularity.HOUR)
);
RealtimeIOConfig ioConfig = new RealtimeIOConfig(

View File

@ -41,7 +41,6 @@ import io.druid.query.Query;
import io.druid.query.QueryRunnerFactory;
import io.druid.query.aggregation.AggregatorFactory;
import io.druid.query.aggregation.CountAggregatorFactory;
import io.druid.segment.column.ColumnConfig;
import io.druid.segment.indexing.DataSchema;
import io.druid.segment.indexing.RealtimeTuningConfig;
import io.druid.segment.indexing.granularity.UniformGranularitySpec;
@ -102,7 +101,7 @@ public class RealtimePlumberSchoolTest
return null;
}
},
new AggregatorFactory[]{new CountAggregatorFactory("rows")},
new AggregatorFactory[]{new CountAggregatorFactory("rows", null)},
new UniformGranularitySpec(Granularity.HOUR, QueryGranularity.NONE, null, Granularity.HOUR)
);

View File

@ -49,7 +49,7 @@ public class SinkTest
final DataSchema schema = new DataSchema(
"test",
null,
new AggregatorFactory[]{new CountAggregatorFactory("rows")},
new AggregatorFactory[]{new CountAggregatorFactory("rows", null)},
new UniformGranularitySpec(Granularity.HOUR, QueryGranularity.MINUTE, null, Granularity.HOUR)
);

View File

@ -113,7 +113,7 @@ public class TieredBrokerHostSelectorTest
Druids.newTimeseriesQueryBuilder()
.dataSource("test")
.granularity("all")
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("rows")))
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("rows", null)))
.intervals(Arrays.<Interval>asList(new Interval("2011-08-31/2011-09-01")))
.build()
).lhs;
@ -129,7 +129,7 @@ public class TieredBrokerHostSelectorTest
Druids.newTimeseriesQueryBuilder()
.dataSource("test")
.granularity("all")
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("rows")))
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("rows", null)))
.intervals(Arrays.<Interval>asList(new Interval("2013-08-31/2013-09-01")))
.build()
).lhs;
@ -144,7 +144,7 @@ public class TieredBrokerHostSelectorTest
Druids.newTimeseriesQueryBuilder()
.dataSource("test")
.granularity("all")
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("rows")))
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("rows", null)))
.intervals(Arrays.<Interval>asList(new Interval("2010-08-31/2010-09-01")))
.build()
).lhs;
@ -158,7 +158,7 @@ public class TieredBrokerHostSelectorTest
String brokerName = (String) brokerSelector.select(
Druids.newTimeseriesQueryBuilder()
.dataSource("test")
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("count")))
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("count", null)))
.intervals(
new MultipleIntervalSegmentSpec(
Arrays.<Interval>asList(
@ -179,7 +179,7 @@ public class TieredBrokerHostSelectorTest
String brokerName = (String) brokerSelector.select(
Druids.newTimeseriesQueryBuilder()
.dataSource("test")
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("count")))
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("count", null)))
.intervals(
new MultipleIntervalSegmentSpec(
Arrays.<Interval>asList(
@ -200,7 +200,7 @@ public class TieredBrokerHostSelectorTest
String brokerName = (String) brokerSelector.select(
Druids.newTimeseriesQueryBuilder()
.dataSource("test")
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("count")))
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("count", null)))
.intervals(
new MultipleIntervalSegmentSpec(
Arrays.<Interval>asList(
@ -223,7 +223,7 @@ public class TieredBrokerHostSelectorTest
String brokerName = (String) brokerSelector.select(
Druids.newTimeseriesQueryBuilder()
.dataSource("test")
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("count")))
.aggregators(Arrays.<AggregatorFactory>asList(new CountAggregatorFactory("count", null)))
.intervals(
new MultipleIntervalSegmentSpec(
Arrays.<Interval>asList(