private AggregationBuilder buildSelectAggregations ( AggregationBuilder aggregationBuilder , SelectStatement selectStatement , EntityMetadata entityMetadata ) { Expression expression = ( ( SelectClause ) selectStatement . getSelectClause ( ) ) . getSelectExpression ( ) ; if ( expression instanceof CollectionExpression ) { aggregationBuilder = appendAggregation ( ( CollectionExpression ) expression , entityMetadata , aggregationBuilder ) ; } else { if ( isAggregationExpression ( expression ) && checkIfKeyExists ( expression . toParsedText ( ) ) ) aggregationBuilder . subAggregation ( getMetricsAggregation ( expression , entityMetadata ) ) ; } return aggregationBuilder ; }
Builds the select aggregations .