jihoonson commented on a change in pull request #8141: Use PartitionsSpec for
all task types
URL: https://github.com/apache/incubator-druid/pull/8141#discussion_r307897155
##########
File path:
indexing-hadoop/src/main/java/org/apache/druid/indexer/partitions/SingleDimensionPartitionsSpec.java
##########
@@ -22,29 +22,55 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.ImmutableList;
-import org.apache.druid.indexer.DeterminePartitionsJob;
-import org.apache.druid.indexer.HadoopDruidIndexerConfig;
-import org.apache.druid.indexer.Jobby;
+import com.google.common.base.Preconditions;
import javax.annotation.Nullable;
+import java.util.Collections;
import java.util.List;
+import java.util.Objects;
-public class SingleDimensionPartitionsSpec extends AbstractPartitionsSpec
+public class SingleDimensionPartitionsSpec implements
DimensionBasedPartitionsSpec
{
+ private final int maxRowsPerSegment;
+ private final int maxPartitionSize;
@Nullable
private final String partitionDimension;
+ private final boolean assumeGrouped;
@JsonCreator
public SingleDimensionPartitionsSpec(
+ @JsonProperty("maxRowsPerSegment") int maxRowsPerSegment,
+ @JsonProperty("maxPartitionSize") @Nullable Integer maxPartitionSize,
@JsonProperty("partitionDimension") @Nullable String partitionDimension,
- @JsonProperty("targetPartitionSize") @Nullable Long targetPartitionSize,
- @JsonProperty("maxPartitionSize") @Nullable Long maxPartitionSize,
- @JsonProperty("assumeGrouped") @Nullable Boolean assumeGrouped
+ @JsonProperty("assumeGrouped") boolean assumeGrouped // false by default
)
{
- super(targetPartitionSize, maxPartitionSize, assumeGrouped, null);
+ Preconditions.checkArgument(maxRowsPerSegment > 0, "maxRowsPerSegment must
be specified");
+ this.maxRowsPerSegment = maxRowsPerSegment;
+ this.maxPartitionSize = PartitionsSpec.isEffectivelyNull(maxPartitionSize)
+ ? Math.multiplyExact(maxRowsPerSegment, (int)
(maxRowsPerSegment * 0.5))
Review comment:
Nice finding! This should be `Math.addExact(maxRowsPerSegment, (int)
(maxRowsPerSegment * 0.5))`. Thanks.
----------------------------------------------------------------
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]