FrankChen021 commented on code in PR #12473:
URL: https://github.com/apache/druid/pull/12473#discussion_r857652180


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/config/TaskConfig.java:
##########
@@ -184,14 +228,48 @@ public String getBaseDir()
   }
 
   @JsonProperty
-  public File getBaseTaskDir()
+  public List<StorageLocationConfig> getBaseTaskDirLocations()
+  {
+    return baseTaskDirLocations;
+  }
+
+  public List<StorageLocationConfig> getBaseTaskDirChildrenLocations(String 
child)
+  {
+    return getBaseTaskDirLocations().stream()
+                                    .map(location -> new StorageLocationConfig(
+                                        getChildFileFromLocation(location, 
child),
+                                        location.getMaxSize(),
+                                        location.getFreeSpacePercent()))
+                                    .collect(Collectors.toList());
+  }
+
+  private File getChildFileFromLocation(StorageLocationConfig location, String 
child)
+  {
+    return new File(location.getPath(), child);
+  }
+
+  private StorageLocationConfig getBaseTaskDirLocationForId(String taskId)
+  {
+    if (taskId == null) {
+      return null;
+    }
+    // TODO: consider the size of each of the base locations for distribution
+    // use uniformly RANDOM assignment
+    int index = taskId.hashCode() % baseTaskDirLocations.size();

Review Comment:
   > I agree, however the bug analyzer complains that 
Math.abs(Integer.MIN_VALUE) is invalid
   
   Which bug analyzer? spotbugs?



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to