@@ -357,16 +357,20 @@ public Map<String, Long> buildQueryBreakdownMap(
357357 avgBreakdownTypeCount ,
358358 sliceBreakdownTypeCount
359359 );
360- // query start/end time for a TimingType is min/max of start/end time across slices for that TimingType
361- queryTimingTypeEndTime = Math .max (
362- queryTimingTypeEndTime ,
363- sliceBreakdown .getValue ().getOrDefault (sliceEndTimeForTimingType , Long .MIN_VALUE )
364- );
365- queryTimingTypeStartTime = Math .min (
366- queryTimingTypeStartTime ,
367- sliceBreakdown .getValue ().getOrDefault (sliceStartTimeForTimingType , Long .MAX_VALUE )
368- );
369- queryTimingTypeCount += sliceBreakdownTypeCount ;
360+
361+ // only modify the start/end time of the TimingType if the slice used the timer
362+ if (sliceBreakdownTypeCount > 0L ) {
363+ // query start/end time for a TimingType is min/max of start/end time across slices for that TimingType
364+ queryTimingTypeEndTime = Math .max (
365+ queryTimingTypeEndTime ,
366+ sliceBreakdown .getValue ().getOrDefault (sliceEndTimeForTimingType , Long .MIN_VALUE )
367+ );
368+ queryTimingTypeStartTime = Math .min (
369+ queryTimingTypeStartTime ,
370+ sliceBreakdown .getValue ().getOrDefault (sliceStartTimeForTimingType , Long .MAX_VALUE )
371+ );
372+ queryTimingTypeCount += sliceBreakdownTypeCount ;
373+ }
370374 }
371375
372376 if (queryTimingTypeCount > 0L && (queryTimingTypeStartTime == Long .MAX_VALUE || queryTimingTypeEndTime == Long .MIN_VALUE )) {
0 commit comments