indexing-service/src/main/java/org/apache/druid/indexing/input/DruidInputSource.java
/**
   * Returns a map of {@link WindowedSegmentId} to size, sorted by {@link WindowedSegmentId#getSegmentId()}.
   */
Returns a map of  WindowedSegmentId to size, sorted by  WindowedSegmentId#getSegmentId().
Returns a map of WindowedSegmentId to size sorted by WindowedSegmentId#getSegmentId () .
private static SortedMap<WindowedSegmentId, Long> createWindowedSegmentIdFromTimeline(
      List<TimelineObjectHolder<String, DataSegment>> timelineHolders
  )
  {
    Map<DataSegment, WindowedSegmentId> windowedSegmentIds = new HashMap<>();
    for (TimelineObjectHolder<String, DataSegment> holder : timelineHolders) {
      for (PartitionChunk<DataSegment> chunk : holder.getObject()) {
        windowedSegmentIds.computeIfAbsent(
            chunk.getObject(),
            segment -> new WindowedSegmentId(segment.getId().toString(), new ArrayList<>())
        ).addInterval(holder.getInterval());
      }
    }
    SortedMap<WindowedSegmentId, Long> segmentSizeMap = new TreeMap<>(WINDOWED_SEGMENT_ID_COMPARATOR);
    windowedSegmentIds.forEach((segment, segmentId) -> segmentSizeMap.put(segmentId, segment.getSize()));
    return segmentSizeMap;
  }
private static SortedMap < WindowedSegmentId , Long > createWindowedSegmentIdFromTimeline ( List < TimelineObjectHolder < String , DataSegment > > timelineHolders ) { Map < DataSegment , WindowedSegmentId > windowedSegmentIds = new HashMap < > ( ) ; for ( TimelineObjectHolder < String , DataSegment > holder : timelineHolders ) { for ( PartitionChunk < DataSegment > chunk : holder . getObject ( ) ) { windowedSegmentIds . computeIfAbsent ( chunk . getObject ( ) , segment -> new WindowedSegmentId ( segment . getId ( ) . toString ( ) , new ArrayList < > ( ) ) ) . addInterval ( holder . getInterval ( ) ) ; } } SortedMap < WindowedSegmentId , Long > segmentSizeMap = new TreeMap < > ( WINDOWED_SEGMENT_ID_COMPARATOR ) ; windowedSegmentIds . forEach ( ( segment , segmentId ) -> segmentSizeMap . put ( segmentId , segment . getSize ( ) ) ) ; return segmentSizeMap ; }
Returns a map of {@link WindowedSegmentId} to size, sorted by {@link WindowedSegmentId#getSegmentId()}.
Returns a map of { @link WindowedSegmentId } to size sorted by { @link WindowedSegmentId#getSegmentId () } .
// It is important to create this map after windowedSegmentIds is completely filled, because WindowedSegmentIds // can be updated while being constructed. (Intervals are added.)