gianm commented on a change in pull request #5653: topN: Fix caching of Float 
dimension values.
URL: https://github.com/apache/incubator-druid/pull/5653#discussion_r208764199
 
 

 ##########
 File path: 
processing/src/test/java/io/druid/query/topn/TopNQueryQueryToolChestTest.java
 ##########
 @@ -61,76 +63,15 @@
   @Test
   public void testCacheStrategy() throws Exception
   {
-    CacheStrategy<Result<TopNResultValue>, Object, TopNQuery> strategy =
-        new TopNQueryQueryToolChest(null, null).getCacheStrategy(
-            new TopNQuery(
-                new TableDataSource("dummy"),
-                VirtualColumns.EMPTY,
-                new DefaultDimensionSpec("test", "test"),
-                new NumericTopNMetricSpec("metric1"),
-                3,
-                new 
MultipleIntervalSegmentSpec(ImmutableList.of(Intervals.of("2015-01-01/2015-01-02"))),
-                null,
-                Granularities.ALL,
-                ImmutableList.<AggregatorFactory>of(new 
CountAggregatorFactory("metric1")),
-                ImmutableList.<PostAggregator>of(new 
ConstantPostAggregator("post", 10)),
-                null
-            )
-        );
-
-    final Result<TopNResultValue> result1 = new Result<>(
-        // test timestamps that result in integer size millis
-        DateTimes.utc(123L),
-        new TopNResultValue(
-            Arrays.asList(
-                ImmutableMap.<String, Object>of(
-                    "test", "val1",
-                    "metric1", 2
-                )
-            )
-        )
-    );
-
-    Object preparedValue = strategy.prepareForSegmentLevelCache().apply(
-        result1
-    );
-
-    ObjectMapper objectMapper = TestHelper.makeJsonMapper();
-    Object fromCacheValue = objectMapper.readValue(
-        objectMapper.writeValueAsBytes(preparedValue),
-        strategy.getCacheObjectClazz()
-    );
-
-    Result<TopNResultValue> fromCacheResult = 
strategy.pullFromSegmentLevelCache().apply(fromCacheValue);
-
-    Assert.assertEquals(result1, fromCacheResult);
-
-    final Result<TopNResultValue> result2 = new Result<>(
-        // test timestamps that result in integer size millis
-        DateTimes.utc(123L),
-        new TopNResultValue(
-            Arrays.asList(
-                ImmutableMap.<String, Object>of(
-                    "test", "val1",
-                    "metric1", 2,
-                    "post", 10
-                )
-            )
-        )
-    );
-
-    Object preparedResultCacheValue = strategy.prepareForCache(true).apply(
-        result2
-    );
-
-    Object fromResultCacheValue = objectMapper.readValue(
-        objectMapper.writeValueAsBytes(preparedResultCacheValue),
-        strategy.getCacheObjectClazz()
-    );
-
-    Result<TopNResultValue> fromResultCacheResult = 
strategy.pullFromCache(true).apply(fromResultCacheValue);
-    Assert.assertEquals(result2, fromResultCacheResult);
+    doTestCacheStrategy(ValueType.STRING, "val1");
+    doTestCacheStrategy(ValueType.FLOAT, 2.1f);
+    doTestCacheStrategy(ValueType.DOUBLE, 2.1d);
+    doTestCacheStrategy(ValueType.LONG, 2L);
+  }
 
+  @Test
+  public void testCacheStrategyWithFloatDimension() throws Exception
+  {
 
 Review comment:
   No, I must have included it by accident. I think it's not needed since I 
modified the `testCacheStrategy` test to check all four supported types.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to