druid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-druid] surekhasaharan commented on a change in pull request #8810: Make submit task API similar to supervisor API
Date Wed, 13 Nov 2019 20:49:37 GMT
surekhasaharan commented on a change in pull request #8810: Make submit task API similar to
supervisor API
URL: https://github.com/apache/incubator-druid/pull/8810#discussion_r345933824
 
 

 ##########
 File path: indexing-service/src/test/java/org/apache/druid/indexing/common/task/TaskSerdeTest.java
 ##########
 @@ -259,6 +263,175 @@ public void testIndexTaskSerde() throws Exception
     Assert.assertEquals(taskTuningConfig.isReportParseExceptions(), task2TuningConfig.isReportParseExceptions());
   }
 
+  @Test
+  public void testIndexTaskNullSpecSerde() throws Exception
+  {
+    final IndexTask task = new IndexTask(
+        null,
+        null,
+        null,
+        new DataSchema(
+            "foo",
+            null,
+            new AggregatorFactory[]{new DoubleSumAggregatorFactory("met", "met")},
+            new UniformGranularitySpec(
+                Granularities.DAY,
+                null,
+                ImmutableList.of(Intervals.of("2010-01-01/P2D"))
+            ),
+            null,
+            jsonMapper
+        ),
+        new IndexIOConfig(new LocalFirehoseFactory(new File("lol"), "rofl", null), true),
+        new IndexTuningConfig(
+            null,
+            null,
+            10,
+            null,
+            null,
+            9999,
+            null,
+            null,
+            new DynamicPartitionsSpec(10000, null),
+            indexSpec,
+            null,
+            3,
+            false,
+            null,
+            null,
+            null,
+            null,
+            null,
+            null,
+            null
+        ),
+        null,
+        AuthTestUtils.TEST_AUTHORIZER_MAPPER,
+        null,
+        rowIngestionMetersFactory,
+        null
+    );
+
+    final String json = jsonMapper.writeValueAsString(task);
+
+    Thread.sleep(100); // Just want to run the clock a bit to make sure the task id doesn't
change
+    final IndexTask task2 = (IndexTask) jsonMapper.readValue(json, Task.class);
+
+    Assert.assertEquals("foo", task.getDataSource());
+
+    Assert.assertEquals(task.getId(), task2.getId());
+    Assert.assertEquals(task.getGroupId(), task2.getGroupId());
+    Assert.assertEquals(task.getDataSource(), task2.getDataSource());
+
+    IndexTask.IndexIOConfig taskIoConfig = task.getIngestionSchema().getIOConfig();
+    IndexTask.IndexIOConfig task2IoConfig = task2.getIngestionSchema().getIOConfig();
+
+    Assert.assertTrue(taskIoConfig.getFirehoseFactory() instanceof LocalFirehoseFactory);
+    Assert.assertTrue(task2IoConfig.getFirehoseFactory() instanceof LocalFirehoseFactory);
+    Assert.assertEquals(taskIoConfig.isAppendToExisting(), task2IoConfig.isAppendToExisting());
+
+    IndexTask.IndexTuningConfig taskTuningConfig = task.getIngestionSchema().getTuningConfig();
+    IndexTask.IndexTuningConfig task2TuningConfig = task2.getIngestionSchema().getTuningConfig();
+
+    Assert.assertEquals(taskTuningConfig.getBasePersistDirectory(), task2TuningConfig.getBasePersistDirectory());
+    Assert.assertEquals(taskTuningConfig.getIndexSpec(), task2TuningConfig.getIndexSpec());
+    Assert.assertEquals(
+        taskTuningConfig.getIntermediatePersistPeriod(),
+        task2TuningConfig.getIntermediatePersistPeriod()
+    );
+    Assert.assertEquals(taskTuningConfig.getMaxPendingPersists(), task2TuningConfig.getMaxPendingPersists());
+    Assert.assertEquals(taskTuningConfig.getMaxRowsInMemory(), task2TuningConfig.getMaxRowsInMemory());
+    Assert.assertEquals(taskTuningConfig.getNumShards(), task2TuningConfig.getNumShards());
+    Assert.assertEquals(taskTuningConfig.getMaxRowsPerSegment(), task2TuningConfig.getMaxRowsPerSegment());
+    Assert.assertEquals(taskTuningConfig.isReportParseExceptions(), task2TuningConfig.isReportParseExceptions());
+  }
+
+  @Test(expected = ISE.class)
+  public void testIndexTaskInvalidSpecSerde()
+  {
+    new IndexTask(
 
 Review comment:
   moved this to `IndexTaskTest`

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


With regards,
Apache Git Services

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


Mime
View raw message