mirror of https://github.com/apache/druid.git
Removal of TopNResultMerger because it is vestigial. (#4520)
This commit is contained in:
parent
ad76f7a1ab
commit
53e6b5cb9b
|
@ -38,7 +38,6 @@ import java.util.Map;
|
|||
*/
|
||||
public class TopNBinaryFn implements BinaryFn<Result<TopNResultValue>, Result<TopNResultValue>, Result<TopNResultValue>>
|
||||
{
|
||||
private final TopNResultMerger merger;
|
||||
private final DimensionSpec dimSpec;
|
||||
private final Granularity gran;
|
||||
private final String dimension;
|
||||
|
@ -49,7 +48,6 @@ public class TopNBinaryFn implements BinaryFn<Result<TopNResultValue>, Result<To
|
|||
private final Comparator comparator;
|
||||
|
||||
public TopNBinaryFn(
|
||||
final TopNResultMerger merger,
|
||||
final Granularity granularity,
|
||||
final DimensionSpec dimSpec,
|
||||
final TopNMetricSpec topNMetricSpec,
|
||||
|
@ -58,7 +56,6 @@ public class TopNBinaryFn implements BinaryFn<Result<TopNResultValue>, Result<To
|
|||
final List<PostAggregator> postAggregatorSpecs
|
||||
)
|
||||
{
|
||||
this.merger = merger;
|
||||
this.dimSpec = dimSpec;
|
||||
this.gran = granularity;
|
||||
this.topNMetricSpec = topNMetricSpec;
|
||||
|
@ -78,10 +75,10 @@ public class TopNBinaryFn implements BinaryFn<Result<TopNResultValue>, Result<To
|
|||
public Result<TopNResultValue> apply(Result<TopNResultValue> arg1, Result<TopNResultValue> arg2)
|
||||
{
|
||||
if (arg1 == null) {
|
||||
return merger.getResult(arg2, comparator);
|
||||
return arg2;
|
||||
}
|
||||
if (arg2 == null) {
|
||||
return merger.getResult(arg1, comparator);
|
||||
return arg1;
|
||||
}
|
||||
|
||||
Map<Object, DimensionAndMetricValueExtractor> retVals = new LinkedHashMap<>();
|
||||
|
|
|
@ -139,7 +139,6 @@ public class TopNQueryQueryToolChest extends QueryToolChest<Result<TopNResultVal
|
|||
{
|
||||
TopNQuery query = (TopNQuery) input;
|
||||
return new TopNBinaryFn(
|
||||
TopNResultMerger.identity,
|
||||
query.getGranularity(),
|
||||
query.getDimensionSpec(),
|
||||
query.getTopNMetricSpec(),
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Licensed to Metamarkets Group Inc. (Metamarkets) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. Metamarkets licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package io.druid.query.topn;
|
||||
|
||||
import io.druid.query.Result;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface TopNResultMerger
|
||||
{
|
||||
public static TopNResultMerger identity = new TopNResultMerger()
|
||||
{
|
||||
@Override
|
||||
public Result<TopNResultValue> getResult(Result<TopNResultValue> result, Comparator comparator)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
public Result<TopNResultValue> getResult(Result<TopNResultValue> result, Comparator comparator);
|
||||
}
|
|
@ -115,7 +115,6 @@ public class TopNBinaryFnBenchmark extends SimpleBenchmark
|
|||
new TopNResultValue(list2)
|
||||
);
|
||||
fn = new TopNBinaryFn(
|
||||
TopNResultMerger.identity,
|
||||
Granularities.ALL,
|
||||
new DefaultDimensionSpec("testdim", null),
|
||||
new NumericTopNMetricSpec("index"),
|
||||
|
|
|
@ -144,7 +144,6 @@ public class TopNBinaryFnTest
|
|||
);
|
||||
|
||||
Result<TopNResultValue> actual = new TopNBinaryFn(
|
||||
TopNResultMerger.identity,
|
||||
Granularities.ALL,
|
||||
new DefaultDimensionSpec("testdim", null),
|
||||
new NumericTopNMetricSpec("index"),
|
||||
|
@ -226,7 +225,6 @@ public class TopNBinaryFnTest
|
|||
);
|
||||
|
||||
Result<TopNResultValue> actual = new TopNBinaryFn(
|
||||
TopNResultMerger.identity,
|
||||
Granularities.DAY,
|
||||
new DefaultDimensionSpec("testdim", null),
|
||||
new NumericTopNMetricSpec("index"),
|
||||
|
@ -271,7 +269,6 @@ public class TopNBinaryFnTest
|
|||
Result<TopNResultValue> expected = result1;
|
||||
|
||||
Result<TopNResultValue> actual = new TopNBinaryFn(
|
||||
TopNResultMerger.identity,
|
||||
Granularities.ALL,
|
||||
new DefaultDimensionSpec("testdim", null),
|
||||
new NumericTopNMetricSpec("index"),
|
||||
|
@ -367,7 +364,6 @@ public class TopNBinaryFnTest
|
|||
);
|
||||
|
||||
Result<TopNResultValue> actual = new TopNBinaryFn(
|
||||
TopNResultMerger.identity,
|
||||
Granularities.ALL,
|
||||
new DefaultDimensionSpec("testdim", null),
|
||||
new NumericTopNMetricSpec("addrowsindexconstant"),
|
||||
|
@ -449,7 +445,6 @@ public class TopNBinaryFnTest
|
|||
);
|
||||
|
||||
Result<TopNResultValue> actual = new TopNBinaryFn(
|
||||
TopNResultMerger.identity,
|
||||
Granularities.ALL,
|
||||
new DefaultDimensionSpec("testdim", null),
|
||||
new NumericTopNMetricSpec("index"),
|
||||
|
@ -507,7 +502,6 @@ public class TopNBinaryFnTest
|
|||
);
|
||||
|
||||
Result<TopNResultValue> actual = new TopNBinaryFn(
|
||||
TopNResultMerger.identity,
|
||||
Granularities.ALL,
|
||||
new DefaultDimensionSpec("INVALID_DIM_NAME", null),
|
||||
new DimensionTopNMetricSpec(null, StringComparators.LEXICOGRAPHIC),
|
||||
|
|
Loading…
Reference in New Issue