Skip to content

Commit 6d8055b

Browse files
committed
fix: address datasketches migration review comments
1 parent 690542e commit 6d8055b

3 files changed

Lines changed: 10 additions & 20 deletions

File tree

extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchMergeAggregatorFactoryTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ public void testGetMergingFactoryDifferentStringEncoding()
130130
SHOULD_FINALIZE,
131131
ROUND
132132
);
133-
HllSketchAggregatorFactory result = (HllSketchAggregatorFactory) targetRound.getMergingFactory(other);
134-
Assertions.assertEquals(LG_K, result.getLgK());
133+
targetRound.getMergingFactory(other);
135134
});
136135
}
137136

extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregationWithSimpleDataTest.java

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.apache.druid.java.util.common.granularity.Granularities;
3535
import org.apache.druid.java.util.common.guava.Sequence;
3636
import org.apache.druid.query.Druids;
37-
import org.apache.druid.query.QueryContexts;
3837
import org.apache.druid.query.Result;
3938
import org.apache.druid.query.aggregation.AggregationTestHelper;
4039
import org.apache.druid.query.aggregation.post.FieldAccessPostAggregator;
@@ -53,7 +52,6 @@
5352
import org.apache.druid.query.topn.TopNResultValue;
5453
import org.apache.druid.testing.InitializedNullHandlingTest;
5554
import org.junit.jupiter.api.Assertions;
56-
import org.junit.jupiter.api.BeforeEach;
5755
import org.junit.jupiter.api.io.TempDir;
5856
import org.junit.jupiter.params.ParameterizedTest;
5957
import org.junit.jupiter.params.provider.MethodSource;
@@ -71,19 +69,10 @@ public class SketchAggregationWithSimpleDataTest extends InitializedNullHandling
7169
@TempDir
7270
private File tempFolder;
7371

74-
private GroupByQueryConfig config;
75-
private QueryContexts.Vectorize vectorize;
76-
7772
private SketchModule sm;
7873
private File s1;
7974
private File s2;
8075

81-
public void initSketchAggregationWithSimpleDataTest(GroupByQueryConfig config, String vectorize)
82-
{
83-
this.config = config;
84-
this.vectorize = QueryContexts.Vectorize.fromString(vectorize);
85-
}
86-
8776
public static Collection<?> constructorFeeder()
8877
{
8978
final List<Object[]> constructors = new ArrayList<>();
@@ -95,8 +84,7 @@ public static Collection<?> constructorFeeder()
9584
return constructors;
9685
}
9786

98-
@BeforeEach
99-
public void setup() throws Exception
87+
private void setup(final GroupByQueryConfig config) throws Exception
10088
{
10189
SketchModule.registerSerde();
10290
sm = new SketchModule();
@@ -150,7 +138,7 @@ public void setup() throws Exception
150138
@ParameterizedTest(name = "config = {0}, vectorize = {1}")
151139
public void testSimpleDataIngestAndGpByQuery(GroupByQueryConfig config, String vectorize) throws Exception
152140
{
153-
initSketchAggregationWithSimpleDataTest(config, vectorize);
141+
setup(config);
154142
try (
155143
final AggregationTestHelper gpByQueryAggregationTestHelper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
156144
sm.getJacksonModules(),
@@ -309,7 +297,7 @@ public void testSimpleDataIngestAndGpByQuery(GroupByQueryConfig config, String v
309297
@ParameterizedTest(name = "config = {0}, vectorize = {1}")
310298
public void testSimpleDataIngestAndTimeseriesQuery(GroupByQueryConfig config, String vectorize) throws Exception
311299
{
312-
initSketchAggregationWithSimpleDataTest(config, vectorize);
300+
setup(config);
313301
AggregationTestHelper timeseriesQueryAggregationTestHelper = AggregationTestHelper.createTimeseriesQueryAggregationTestHelperWithTempDir(
314302
sm.getJacksonModules(),
315303
tempFolder
@@ -392,7 +380,7 @@ public void testSimpleDataIngestAndTimeseriesQuery(GroupByQueryConfig config, St
392380
@ParameterizedTest(name = "config = {0}, vectorize = {1}")
393381
public void testSimpleDataIngestAndTopNQuery(GroupByQueryConfig config, String vectorize) throws Exception
394382
{
395-
initSketchAggregationWithSimpleDataTest(config, vectorize);
383+
setup(config);
396384
AggregationTestHelper topNQueryAggregationTestHelper = AggregationTestHelper.createTopNQueryAggregationTestHelperWithTempDir(
397385
sm.getJacksonModules(),
398386
tempFolder
@@ -479,7 +467,7 @@ public void testSimpleDataIngestAndTopNQuery(GroupByQueryConfig config, String v
479467
@ParameterizedTest(name = "config = {0}, vectorize = {1}")
480468
public void testTopNQueryWithSketchConstant(GroupByQueryConfig config, String vectorize) throws Exception
481469
{
482-
initSketchAggregationWithSimpleDataTest(config, vectorize);
470+
setup(config);
483471
AggregationTestHelper topNQueryAggregationTestHelper = AggregationTestHelper.createTopNQueryAggregationTestHelperWithTempDir(
484472
sm.getJacksonModules(),
485473
tempFolder

extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/oldapi/OldApiSketchAggregationTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ public static Collection<?> constructorFeeder()
9191
@AfterEach
9292
public void teardown() throws IOException
9393
{
94-
helper.close();
94+
if (helper != null) {
95+
helper.close();
96+
helper = null;
97+
}
9598
}
9699

97100
@MethodSource("constructorFeeder")

0 commit comments

Comments
 (0)