private void getHistogramRecursively ( TableCountProbingContext probingContext , Histogram histogram , StrSubstitutor sub , Map < String , String > values , int count , long startEpoch , long endEpoch ) { long midpointEpoch = startEpoch + ( endEpoch - startEpoch ) / 2 ; // don't split further if small, above the probe limit, or less than 1 second difference between the midpoint and start if ( count <= probingContext . bucketSizeLimit || probingContext . probeCount > probingContext . probeLimit || ( midpointEpoch - startEpoch < MIN_SPLIT_TIME_MILLIS ) ) { histogram . add ( new HistogramGroup ( Utils . epochToDate ( startEpoch , SECONDS_FORMAT ) , count ) ) ; return ; } int countLeft = getCountForRange ( probingContext , sub , values , startEpoch , midpointEpoch ) ; getHistogramRecursively ( probingContext , histogram , sub , values , countLeft , startEpoch , midpointEpoch ) ; log . debug ( "Count {} for left partition {} to {}" , countLeft , startEpoch , midpointEpoch ) ; int countRight = count - countLeft ; getHistogramRecursively ( probingContext , histogram , sub , values , countRight , midpointEpoch , endEpoch ) ; log . debug ( "Count {} for right partition {} to {}" , countRight , midpointEpoch , endEpoch ) ; }
Split a histogram bucket along the midpoint if it is larger than the bucket size limit .