You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by ji...@apache.org on 2019/03/04 19:05:47 UTC

[incubator-druid] branch master updated: ITIndexerTest: validate new data source after reindex (#7171)

This is an automated email from the ASF dual-hosted git repository.

jihoonson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 7bf1ee4  ITIndexerTest: validate new data source after reindex (#7171)
7bf1ee4 is described below

commit 7bf1ee4dc0d2066d0273d2be237788531b22baa6
Author: David Glasser <gl...@apollographql.com>
AuthorDate: Mon Mar 4 11:05:40 2019 -0800

    ITIndexerTest: validate new data source after reindex (#7171)
    
    Previously, the test validated that the data source that we ingested from still
    had the same query responses that it did before the second ingestion. This is
    less useful than validating queries against the newly created data source.
    
    The new queries file differs from the old one in that its maxTime is earlier due
    to the interval selected by the reindex, and in that it does not query for the
    dropped metric "count".
---
 .../tests/indexer/AbstractITBatchIndexTest.java    |  2 +-
 .../apache/druid/tests/indexer/ITIndexerTest.java  |  3 +-
 .../indexer/wikipedia_reindex_queries.json         | 66 ++++++++++++++++++++++
 3 files changed, 69 insertions(+), 2 deletions(-)

diff --git a/integration-tests/src/test/java/org/apache/druid/tests/indexer/AbstractITBatchIndexTest.java b/integration-tests/src/test/java/org/apache/druid/tests/indexer/AbstractITBatchIndexTest.java
index 2034b60..226824f 100644
--- a/integration-tests/src/test/java/org/apache/druid/tests/indexer/AbstractITBatchIndexTest.java
+++ b/integration-tests/src/test/java/org/apache/druid/tests/indexer/AbstractITBatchIndexTest.java
@@ -123,7 +123,7 @@ public class AbstractITBatchIndexTest extends AbstractIndexerTest
       queryResponseTemplate = StringUtils.replace(
           queryResponseTemplate,
           "%%DATASOURCE%%",
-          fullBaseDatasourceName
+          fullReindexDatasourceName
       );
 
       queryHelper.testQueriesFromString(queryResponseTemplate, 2);
diff --git a/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITIndexerTest.java b/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITIndexerTest.java
index 245c3dd..adc0f88 100644
--- a/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITIndexerTest.java
+++ b/integration-tests/src/test/java/org/apache/druid/tests/indexer/ITIndexerTest.java
@@ -33,6 +33,7 @@ public class ITIndexerTest extends AbstractITBatchIndexTest
   private static String INDEX_DATASOURCE = "wikipedia_index_test";
 
   private static String REINDEX_TASK = "/indexer/wikipedia_reindex_task.json";
+  private static String REINDEX_QUERIES_RESOURCE = "/indexer/wikipedia_reindex_queries.json";
   private static String REINDEX_DATASOURCE = "wikipedia_reindex_test";
 
   @Test
@@ -52,7 +53,7 @@ public class ITIndexerTest extends AbstractITBatchIndexTest
           INDEX_DATASOURCE,
           REINDEX_DATASOURCE,
           REINDEX_TASK,
-          INDEX_QUERIES_RESOURCE
+          REINDEX_QUERIES_RESOURCE
       );
     }
   }
diff --git a/integration-tests/src/test/resources/indexer/wikipedia_reindex_queries.json b/integration-tests/src/test/resources/indexer/wikipedia_reindex_queries.json
new file mode 100644
index 0000000..572e0f1
--- /dev/null
+++ b/integration-tests/src/test/resources/indexer/wikipedia_reindex_queries.json
@@ -0,0 +1,66 @@
+[
+    {
+        "description": "timeseries, 1 agg, all",
+        "query":{
+            "queryType" : "timeBoundary",
+            "dataSource": "%%DATASOURCE%%"
+        },
+        "expectedResults":[
+            {
+                "timestamp" : "2013-08-31T01:02:33.000Z",
+                "result" : {
+                    "minTime" : "2013-08-31T01:02:33.000Z",
+                    "maxTime" : "2013-08-31T12:41:27.000Z"
+                }
+            }
+        ]
+    },
+
+    {
+        "description":"having spec on post aggregation",
+        "query":{
+            "queryType":"groupBy",
+            "dataSource":"%%DATASOURCE%%",
+            "granularity":"day",
+            "dimensions":[
+                "page"
+            ],
+            "filter":{
+                "type":"selector",
+                "dimension":"language",
+                "value":"zh"
+            },
+            "aggregations":[
+                {
+                    "type":"longSum",
+                    "fieldName":"added",
+                    "name":"added_count"
+                }
+            ],
+            "postAggregations": [
+                {
+                    "type":"arithmetic",
+                    "name":"added_count_times_ten",
+                    "fn":"*",
+                    "fields":[
+                        {"type":"fieldAccess", "name":"added_count", "fieldName":"added_count"},
+                        {"type":"constant", "name":"const", "value":10}
+                    ]
+                }
+            ],
+            "having":{"type":"greaterThan", "aggregation":"added_count_times_ten", "value":9000},
+            "intervals":[
+                "2013-08-31T00:00/2013-09-01T00:00"
+            ]
+        },
+        "expectedResults":[ {
+            "version" : "v1",
+            "timestamp" : "2013-08-31T00:00:00.000Z",
+            "event" : {
+                "added_count_times_ten" : 9050.0,
+                "page" : "Crimson Typhoon",
+                "added_count" : 905
+            }
+        } ]
+    }
+]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org