private Terms filterBuckets ( Terms buckets , KunderaQuery query ) { Expression havingClause = query . getSelectStatement ( ) . getHavingClause ( ) ; if ( ! ( havingClause instanceof NullExpression ) && havingClause != null ) { Expression conditionalExpression = ( ( HavingClause ) havingClause ) . getConditionalExpression ( ) ; for ( Iterator < Bucket > bucketIterator = buckets . getBuckets ( ) . iterator ( ) ; bucketIterator . hasNext ( ) ; ) { InternalAggregations internalAgg = ( InternalAggregations ) bucketIterator . next ( ) . getAggregations ( ) ; if ( ! isValidBucket ( internalAgg , query , conditionalExpression ) ) { bucketIterator . remove ( ) ; } } } return buckets ; }
Filter buckets .