You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/07/26 18:19:42 UTC

[GitHub] [incubator-druid] dclim commented on a change in pull request #8141: Use PartitionsSpec for all task types

dclim commented on a change in pull request #8141: Use PartitionsSpec for all task types
URL: https://github.com/apache/incubator-druid/pull/8141#discussion_r307628734
 
 

 ##########
 File path: indexing-hadoop/src/main/java/org/apache/druid/indexer/partitions/HashedPartitionsSpec.java
 ##########
 @@ -20,45 +20,103 @@
 package org.apache.druid.indexer.partitions;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.ImmutableList;
-import org.apache.druid.indexer.DetermineHashedPartitionsJob;
-import org.apache.druid.indexer.HadoopDruidIndexerConfig;
-import org.apache.druid.indexer.Jobby;
+import com.google.common.base.Preconditions;
+import org.apache.druid.java.util.common.logger.Logger;
 
 import javax.annotation.Nullable;
+import java.util.Collections;
 import java.util.List;
+import java.util.Objects;
 
-public class HashedPartitionsSpec extends AbstractPartitionsSpec
+public class HashedPartitionsSpec implements DimensionBasedPartitionsSpec
 {
-  private static final List<String> DEFAULT_PARTITION_DIMENSIONS = ImmutableList.of();
+  private static final Logger LOG = new Logger(HashedPartitionsSpec.class);
 
-  public static HashedPartitionsSpec makeDefaultHashedPartitionsSpec()
-  {
-    return new HashedPartitionsSpec(null, null, null, null, null);
-  }
-
-  @JsonIgnore
+  @Nullable
+  private final Integer maxRowsPerSegment;
+  @Nullable
+  private final Integer numShards;
   private final List<String> partitionDimensions;
 
   @JsonCreator
   public HashedPartitionsSpec(
-      @JsonProperty("targetPartitionSize") @Nullable Long targetPartitionSize,
-      @JsonProperty("maxPartitionSize") @Nullable Long maxPartitionSize,
-      @JsonProperty("assumeGrouped") @Nullable Boolean assumeGrouped,
+      @JsonProperty("maxRowsPerSegment") @Nullable Integer maxRowsPerSegment,
       @JsonProperty("numShards") @Nullable Integer numShards,
       @JsonProperty("partitionDimensions") @Nullable List<String> partitionDimensions
   )
   {
-    super(targetPartitionSize, maxPartitionSize, assumeGrouped, numShards);
-    this.partitionDimensions = partitionDimensions == null ? DEFAULT_PARTITION_DIMENSIONS : partitionDimensions;
+    Preconditions.checkArgument(
+        PartitionsSpec.isEffectivelyNull(maxRowsPerSegment) || PartitionsSpec.isEffectivelyNull(numShards),
+        "Can't use maxRowsPerSegment and numShards together"
 
 Review comment:
   When this is called through `HadoopHashedPartitionsSpec`, the field there is called `targetPartitionSize` instead of `maxRowsPerSegment`, so it might be clearer to indicate that name here as well in addition to `maxRowsPerSegment`

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