public static List < PostAggregator > pruneDependentPostAgg ( List < PostAggregator > postAggregatorList , String postAggName ) { ArrayList < PostAggregator > rv = new ArrayList <> ( ) ; Set < String > deps = new HashSet <> ( ) ; deps . add ( postAggName ) ; // Iterate backwards to find the last calculated aggregate and add dependent aggregator as we find dependencies // in reverse order for ( PostAggregator agg : Lists . reverse ( postAggregatorList ) ) { if ( deps . contains ( agg . getName ( ) ) ) { rv . add ( agg ) ; // add to the beginning of List deps . remove ( agg . getName ( ) ) ; deps . addAll ( agg . getDependentFields ( ) ) ; } } Collections . reverse ( rv ) ; return rv ; }
returns the list of dependent postAggregators that should be calculated in order to calculate given postAgg