clintropolis commented on a change in pull request #8624: Use
targetRowsPerSegment for single-dim partitions
URL: https://github.com/apache/incubator-druid/pull/8624#discussion_r332918729
##########
File path:
indexing-hadoop/src/test/java/org/apache/druid/indexer/HadoopDruidIndexerConfigTest.java
##########
@@ -197,10 +127,132 @@ public void testNoneShardSpecBucketSelection()
"4"
);
final long ts1 = DateTimes.of("2010-01-01T01:00:01").getMillis();
- Assert.assertEquals(config.getBucket(new MapBasedInputRow(ts1, dims,
values)).get().getShardNum(), 1);
+ Assert.assertEquals(1, config.getBucket(new MapBasedInputRow(ts1, dims,
values)).get().getShardNum());
final long ts2 = DateTimes.of("2010-01-01T02:00:01").getMillis();
- Assert.assertEquals(config.getBucket(new MapBasedInputRow(ts2, dims,
values)).get().getShardNum(), 2);
+ Assert.assertEquals(2, config.getBucket(new MapBasedInputRow(ts2, dims,
values)).get().getShardNum());
+ }
+
+ @Test
+ public void testGetTargetPartitionSizeWithHashedPartitions()
+ {
+ HadoopIngestionSpec spec = new HadoopIngestionSpecBuilder()
+ .partitionsSpec(HashedPartitionsSpec.defaultSpec())
+ .build();
+ HadoopDruidIndexerConfig config = new HadoopDruidIndexerConfig(spec);
+ int targetPartitionSize = config.getTargetPartitionSize();
+ Assert.assertEquals(PartitionsSpec.DEFAULT_MAX_ROWS_PER_SEGMENT,
targetPartitionSize);
+ }
+
+ @Test
+ public void
testGetTargetPartitionSizeWithSingleDimensionPartitionsTargetRowsPerSegment()
+ {
+ int targetRowsPerSegment = 123;
+ SingleDimensionPartitionsSpec partitionsSpec = new
SingleDimensionPartitionsSpec(
+ targetRowsPerSegment,
+ null,
+ null,
+ false
+
+ );
+ HadoopIngestionSpec spec = new HadoopIngestionSpecBuilder()
+ .partitionsSpec(partitionsSpec)
+ .build();
+ HadoopDruidIndexerConfig config = new HadoopDruidIndexerConfig(spec);
+ int targetPartitionSize = config.getTargetPartitionSize();
+ Assert.assertEquals(targetRowsPerSegment, targetPartitionSize);
+ }
+
+ @Test
+ public void
testGetTargetPartitionSizeWithSingleDimensionPartitionsMaxRowsPerSegment()
+ {
+ int maxRowsPerSegment = 456;
+ SingleDimensionPartitionsSpec partitionsSpec = new
SingleDimensionPartitionsSpec(
+ null,
+ maxRowsPerSegment,
+ null,
+ false
+ );
+ HadoopIngestionSpec spec = new HadoopIngestionSpecBuilder()
+ .partitionsSpec(partitionsSpec)
+ .build();
+ HadoopDruidIndexerConfig config = new HadoopDruidIndexerConfig(spec);
+ int targetPartitionSize = config.getTargetPartitionSize();
+ Assert.assertEquals(maxRowsPerSegment, targetPartitionSize);
+ }
+
+ private static class HadoopIngestionSpecBuilder
Review comment:
:+1:
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]