ArvinZheng opened a new issue #9849:
URL: https://github.com/apache/druid/issues/9849


   ```
   public Comparator getComparator(List<AggregatorFactory> aggregatorSpecs, 
List<PostAggregator> postAggregatorSpecs)
     {
       Comparator comp = null;
       for (AggregatorFactory factory : aggregatorSpecs) {
         if (metric.equals(factory.getName())) {
           comp = factory.getComparator();
           break;
         }
       }
       for (PostAggregator pf : postAggregatorSpecs) {
         if (metric.equals(pf.getName())) {
           comp = pf.getComparator();
           break;
         }
       }
   
       return comp;
     }
   ```
   as per the above code, if there is a `PostAggregator` which name equals to 
the metric name, we always use the `Comparator from this PostAggregator`, 
change the order of these 2 for loop and return at the break, we can avoid 
unnecessary iteration on `aggregatorSpecs`.


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

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