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 2021/12/09 15:55:41 UTC

[GitHub] [druid] LakshSingla commented on a change in pull request #12046: Segment pruning for multi-dim partitioning given query domain

LakshSingla commented on a change in pull request #12046:
URL: https://github.com/apache/druid/pull/12046#discussion_r765924718



##########
File path: core/src/main/java/org/apache/druid/timeline/partition/DimensionRangeShardSpec.java
##########
@@ -145,29 +141,58 @@ private static ShardSpecLookup createLookup(List<? extends ShardSpec> shardSpecs
     return Collections.unmodifiableList(dimensions);
   }
 
-  private Range<String> getFirstDimRange()
+  /**
+   * Check if a given domain of Strings is a singleton set containing the given value
+   * @param rangeSet Domain of Strings
+   * @param val Value of String
+   * @return rangeSet == {val}
+   */
+  private boolean isRangeSetSingletonWithVal(RangeSet<String> rangeSet, String val)
   {
-    Range<String> range;
-    if (firstDimStart == null && firstDimEnd == null) {
-      range = Range.all();
-    } else if (firstDimStart == null) {
-      range = Range.atMost(firstDimEnd);
-    } else if (firstDimEnd == null) {
-      range = Range.atLeast(firstDimStart);
-    } else {
-      range = Range.closed(firstDimStart, firstDimEnd);
-    }
-    return range;
+    Range<String> singletonRange = Range.closed(val, val);
+    RangeSet<String> singletonRangeSet = TreeRangeSet.create();
+    singletonRangeSet.add(singletonRange);
+    return rangeSet.equals(singletonRangeSet);
   }
 
   @Override
   public boolean possibleInDomain(Map<String, RangeSet<String>> domain)
   {
-    RangeSet<String> rangeSet = domain.get(dimensions.get(0));
-    if (rangeSet == null) {
-      return true;
+    // Indicate if start[0:dim), end[0:dim) are the greatest, least members of domain[0:dim) respectively
+    boolean startIsGreatestInDomain = true, endIsLeastInDomain = true;
+    for (int dim = 0; dim < dimensions.size(); dim++) {

Review comment:
       Nit: Instead of `dim`, can it be something like `i` or `dimIndex` and maybe define `dimension = dimensions.get(i)`




-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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