Remove Aggregator.clone() methods (#6437)

* Remove Aggregator.clone() methods

* Remove CardinalityAggregator.name
This commit is contained in:
Roman Leventov 2018-10-10 10:07:56 -03:00 committed by GitHub
parent d559dfecb2
commit 09126c021a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 9 additions and 101 deletions

View File

@ -101,10 +101,4 @@ public class TimestampAggregator implements Aggregator
{
// no resource to cleanup
}
@Override
public Aggregator clone()
{
return new TimestampAggregator(name, selector, timestampSpec, comparator, initValue);
}
}

View File

@ -68,12 +68,6 @@ public class CountAggregator implements Aggregator
return (double) count;
}
@Override
public Aggregator clone()
{
return new CountAggregator();
}
@Override
public void close()
{

View File

@ -70,12 +70,6 @@ public class DoubleMaxAggregator implements Aggregator
return max;
}
@Override
public Aggregator clone()
{
return new DoubleMaxAggregator(selector);
}
@Override
public void close()
{

View File

@ -70,12 +70,6 @@ public class DoubleMinAggregator implements Aggregator
return min;
}
@Override
public Aggregator clone()
{
return new DoubleMinAggregator(selector);
}
@Override
public void close()
{

View File

@ -78,12 +78,6 @@ public class DoubleSumAggregator implements Aggregator
return (long) sum;
}
@Override
public Aggregator clone()
{
return new DoubleSumAggregator(selector);
}
@Override
public void close()
{

View File

@ -70,12 +70,6 @@ public class FloatMaxAggregator implements Aggregator
return (double) max;
}
@Override
public Aggregator clone()
{
return new FloatMaxAggregator(selector);
}
@Override
public void close()
{

View File

@ -70,12 +70,6 @@ public class FloatMinAggregator implements Aggregator
return (double) min;
}
@Override
public Aggregator clone()
{
return new FloatMinAggregator(selector);
}
@Override
public void close()
{

View File

@ -83,12 +83,6 @@ public class FloatSumAggregator implements Aggregator
return (double) sum;
}
@Override
public Aggregator clone()
{
return new FloatSumAggregator(selector);
}
@Override
public void close()
{

View File

@ -70,12 +70,6 @@ public class LongMaxAggregator implements Aggregator
return (double) max;
}
@Override
public Aggregator clone()
{
return new LongMaxAggregator(selector);
}
@Override
public void close()
{

View File

@ -70,12 +70,6 @@ public class LongMinAggregator implements Aggregator
return (double) min;
}
@Override
public Aggregator clone()
{
return new LongMinAggregator(selector);
}
@Override
public void close()
{

View File

@ -83,12 +83,6 @@ public class LongSumAggregator implements Aggregator
return (double) sum;
}
@Override
public Aggregator clone()
{
return new LongSumAggregator(selector);
}
@Override
public void close()
{

View File

@ -32,10 +32,6 @@ import java.util.List;
public class CardinalityAggregator implements Aggregator
{
private final String name;
private final ColumnSelectorPlus<CardinalityAggregatorColumnSelectorStrategy>[] selectorPluses;
private final boolean byRow;
public static final HashFunction hashFn = Hashing.murmur3_128();
static void hashRow(
@ -65,26 +61,22 @@ public class CardinalityAggregator implements Aggregator
}
}
private final ColumnSelectorPlus<CardinalityAggregatorColumnSelectorStrategy>[] selectorPluses;
private final boolean byRow;
private HyperLogLogCollector collector;
@VisibleForTesting
@SuppressWarnings("unchecked")
CardinalityAggregator(
String name,
List<ColumnSelectorPlus<CardinalityAggregatorColumnSelectorStrategy>> selectorPlusList,
boolean byRow
)
{
this(name, selectorPlusList.toArray(new ColumnSelectorPlus[0]), byRow);
this(selectorPlusList.toArray(new ColumnSelectorPlus[0]), byRow);
}
CardinalityAggregator(
String name,
ColumnSelectorPlus<CardinalityAggregatorColumnSelectorStrategy>[] selectorPluses,
boolean byRow
)
CardinalityAggregator(ColumnSelectorPlus<CardinalityAggregatorColumnSelectorStrategy>[] selectorPluses, boolean byRow)
{
this.name = name;
this.selectorPluses = selectorPluses;
this.collector = HyperLogLogCollector.makeLatestCollector();
this.byRow = byRow;
@ -126,12 +118,6 @@ public class CardinalityAggregator implements Aggregator
throw new UnsupportedOperationException("CardinalityAggregator does not support getDouble()");
}
@Override
public Aggregator clone()
{
return new CardinalityAggregator(name, selectorPluses, byRow);
}
@Override
public void close()
{

View File

@ -142,7 +142,7 @@ public class CardinalityAggregatorFactory extends AggregatorFactory
if (selectorPluses.length == 0) {
return NoopAggregator.instance();
}
return new CardinalityAggregator(name, selectorPluses, byRow);
return new CardinalityAggregator(selectorPluses, byRow);
}

View File

@ -81,12 +81,6 @@ public class HyperUniquesAggregator implements Aggregator
throw new UnsupportedOperationException("HyperUniquesAggregator does not support getDouble()");
}
@Override
public Aggregator clone()
{
return new HyperUniquesAggregator(selector);
}
@Override
public void close()
{

View File

@ -400,7 +400,6 @@ public class CardinalityAggregatorTest
public void testAggregateRows()
{
CardinalityAggregator agg = new CardinalityAggregator(
"billy",
dimInfoList,
true
);
@ -417,7 +416,6 @@ public class CardinalityAggregatorTest
public void testAggregateValues()
{
CardinalityAggregator agg = new CardinalityAggregator(
"billy",
dimInfoList,
false
);
@ -493,8 +491,8 @@ public class CardinalityAggregatorTest
)
);
CardinalityAggregator agg1 = new CardinalityAggregator("billy", dimInfo1, true);
CardinalityAggregator agg2 = new CardinalityAggregator("billy", dimInfo2, true);
CardinalityAggregator agg1 = new CardinalityAggregator(dimInfo1, true);
CardinalityAggregator agg2 = new CardinalityAggregator(dimInfo2, true);
for (int i = 0; i < values1.size(); ++i) {
aggregate(selector1, agg1);
@ -539,8 +537,8 @@ public class CardinalityAggregatorTest
)
);
CardinalityAggregator agg1 = new CardinalityAggregator("billy", dimInfo1, false);
CardinalityAggregator agg2 = new CardinalityAggregator("billy", dimInfo2, false);
CardinalityAggregator agg1 = new CardinalityAggregator(dimInfo1, false);
CardinalityAggregator agg2 = new CardinalityAggregator(dimInfo2, false);
for (int i = 0; i < values1.size(); ++i) {
aggregate(selector1, agg1);
@ -568,7 +566,6 @@ public class CardinalityAggregatorTest
public void testAggregateRowsWithExtraction()
{
CardinalityAggregator agg = new CardinalityAggregator(
"billy",
dimInfoListWithExtraction,
true
);
@ -578,7 +575,6 @@ public class CardinalityAggregatorTest
Assert.assertEquals(9.0, (Double) rowAggregatorFactory.finalizeComputation(agg.get()), 0.05);
CardinalityAggregator agg2 = new CardinalityAggregator(
"billy",
dimInfoListConstantVal,
true
);
@ -592,7 +588,6 @@ public class CardinalityAggregatorTest
public void testAggregateValuesWithExtraction()
{
CardinalityAggregator agg = new CardinalityAggregator(
"billy",
dimInfoListWithExtraction,
false
);
@ -602,7 +597,6 @@ public class CardinalityAggregatorTest
Assert.assertEquals(7.0, (Double) valueAggregatorFactory.finalizeComputation(agg.get()), 0.05);
CardinalityAggregator agg2 = new CardinalityAggregator(
"billy",
dimInfoListConstantVal,
false
);