gianm closed pull request #6213: add ability to do optional rollup in 
AggregationTestHelper
URL: https://github.com/apache/incubator-druid/pull/6213
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java
 
b/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java
index 869d1acdc3a..9ab3b5fb47b 100644
--- 
a/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java
+++ 
b/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java
@@ -343,7 +343,23 @@ public int columnCacheSizeBytes()
   ) throws Exception
   {
     File segmentDir = tempFolder.newFolder();
-    createIndex(inputDataFile, parserJson, aggregators, segmentDir, 
minTimestamp, gran, maxRowCount);
+    createIndex(inputDataFile, parserJson, aggregators, segmentDir, 
minTimestamp, gran, maxRowCount, true);
+    return runQueryOnSegments(Lists.newArrayList(segmentDir), 
groupByQueryJson);
+  }
+
+  public Sequence<Row> createIndexAndRunQueryOnSegment(
+      File inputDataFile,
+      String parserJson,
+      String aggregators,
+      long minTimestamp,
+      Granularity gran,
+      int maxRowCount,
+      boolean rollup,
+      String groupByQueryJson
+  ) throws Exception
+  {
+    File segmentDir = tempFolder.newFolder();
+    createIndex(inputDataFile, parserJson, aggregators, segmentDir, 
minTimestamp, gran, maxRowCount, rollup);
     return runQueryOnSegments(Collections.singletonList(segmentDir), 
groupByQueryJson);
   }
 
@@ -356,9 +372,32 @@ public int columnCacheSizeBytes()
       int maxRowCount,
       String groupByQueryJson
   ) throws Exception
+  {
+    return createIndexAndRunQueryOnSegment(
+        inputDataStream,
+        parserJson,
+        aggregators,
+        minTimestamp,
+        gran,
+        maxRowCount,
+        true,
+        groupByQueryJson
+    );
+  }
+
+  public Sequence<Row> createIndexAndRunQueryOnSegment(
+      InputStream inputDataStream,
+      String parserJson,
+      String aggregators,
+      long minTimestamp,
+      Granularity gran,
+      int maxRowCount,
+      boolean rollup,
+      String groupByQueryJson
+  ) throws Exception
   {
     File segmentDir = tempFolder.newFolder();
-    createIndex(inputDataStream, parserJson, aggregators, segmentDir, 
minTimestamp, gran, maxRowCount);
+    createIndex(inputDataStream, parserJson, aggregators, segmentDir, 
minTimestamp, gran, maxRowCount, rollup);
     return runQueryOnSegments(Collections.singletonList(segmentDir), 
groupByQueryJson);
   }
 
@@ -379,7 +418,31 @@ public void createIndex(
         outDir,
         minTimestamp,
         gran,
-        maxRowCount
+        maxRowCount,
+        true
+    );
+  }
+
+  public void createIndex(
+      File inputDataFile,
+      String parserJson,
+      String aggregators,
+      File outDir,
+      long minTimestamp,
+      Granularity gran,
+      int maxRowCount,
+      boolean rollup
+  ) throws Exception
+  {
+    createIndex(
+        new FileInputStream(inputDataFile),
+        parserJson,
+        aggregators,
+        outDir,
+        minTimestamp,
+        gran,
+        maxRowCount,
+        rollup
     );
   }
 
@@ -390,7 +453,8 @@ public void createIndex(
       File outDir,
       long minTimestamp,
       Granularity gran,
-      int maxRowCount
+      int maxRowCount,
+      boolean rollup
   ) throws Exception
   {
     try {
@@ -412,7 +476,8 @@ public void createIndex(
           minTimestamp,
           gran,
           true,
-          maxRowCount
+          maxRowCount,
+          rollup
       );
     }
     finally {
@@ -428,7 +493,8 @@ public void createIndex(
       long minTimestamp,
       Granularity gran,
       boolean deserializeComplexMetrics,
-      int maxRowCount
+      int maxRowCount,
+      boolean rollup
   ) throws Exception
   {
     IncrementalIndex index = null;
@@ -441,6 +507,7 @@ public void createIndex(
                   .withMinTimestamp(minTimestamp)
                   .withQueryGranularity(gran)
                   .withMetrics(metrics)
+                  .withRollup(rollup)
                   .build()
           )
           .setDeserializeComplexMetrics(deserializeComplexMetrics)
@@ -460,6 +527,7 @@ public void createIndex(
                       .withMinTimestamp(minTimestamp)
                       .withQueryGranularity(gran)
                       .withMetrics(metrics)
+                      .withRollup(rollup)
                       .build()
               )
               .setDeserializeComplexMetrics(deserializeComplexMetrics)
@@ -484,7 +552,7 @@ public void createIndex(
         for (File file : toMerge) {
           indexes.add(indexIO.loadIndex(file));
         }
-        indexMerger.mergeQueryableIndex(indexes, true, metrics, outDir, new 
IndexSpec(), null);
+        indexMerger.mergeQueryableIndex(indexes, rollup, metrics, outDir, new 
IndexSpec(), null);
 
         for (QueryableIndex qi : indexes) {
           qi.close();


 

----------------------------------------------------------------
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