Moved mapSegmentCountsToGlobalCounts() check for last segment to postCollect
Compute maxOrd in factory if global ordinals is going to be used.
Use maxOrd to pick GLOBAL_ORDINALS or GLOBAL_ORDINALS_LOW_CARDINALITY
For GLOBAL_ORDINALS and GLOBAL_ORDINALS_LOW_CARDINALITY use maxOrd as bucket count