hqx871 commented on PR #12477:
URL: https://github.com/apache/druid/pull/12477#issuecomment-1107450601

   Hi, I found a case, the segment should be in domain, but throws an 
exception: Invalid range: [025‥015]
   ```
       Map<String, RangeSet<String>> domain = ImmutableMap.of(
           "dim1",
           rangeSet(
               ImmutableList.of(
                   Range.singleton("003"),
                   Range.singleton("004")
               )),
           "dim2",
           rangeSet(ImmutableList.of(Range.singleton("026")))
       );
   
       ShardSpec shardSpec = makeSpec(
           Arrays.asList("dim1", "dim2", "dim3"),
           StringTuple.create("003", "025", "010"),
           StringTuple.create("005", "015", "030")
       );
       Assert.assertTrue(shardSpec.possibleInDomain(domain));
   ```
   What about make a little code change?
   ```
         final Range<String> firstRange = effectiveDomainRangeIterator.next();
   
         boolean singleEffectiveDomainRange = 
!effectiveDomainRangeIterator.hasNext();
         // Effective domain contained only one Range.
         // If it's a singleton and lies only on the boundaries -> consider 
next dimensions
         effectiveDomainIsStart = effectiveDomainIsStart
                                  && singleEffectiveDomainRange
                                  && segmentStart.get(i) != null
                                  && 
firstRange.equals(Range.singleton(segmentStart.get(i)));
         effectiveDomainIsEnd = effectiveDomainIsEnd
                                && singleEffectiveDomainRange
                                && segmentEnd.get(i) != null
                                && 
firstRange.equals(Range.singleton(segmentEnd.get(i)));
   
         // EffectiveDomain lies within the boundaries as well -> cannot prune 
based on next dimensions
         if (!effectiveDomainIsStart && !effectiveDomainIsEnd) {
           return true;
         }
   ```
   Please feel free to correct me if I am wrong


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