/** * Extract an OrderBy PostAggregation. * * @return A PostAggregation based on an OrderBy node */ public PostAggregation extractOrderBy() { List<com.yahoo.bullet.parsing.OrderBy.SortItem> fields = node.getSortItems().stream().map(sortItem -> new com.yahoo.bullet.parsing.OrderBy.SortItem( sortItem.getSortKey().toFormatlessString(), sortItem.getOrdering() == SortItem.Ordering.DESCENDING ? Direction.DESC : Direction.ASC) ).collect(Collectors.toList()); com.yahoo.bullet.parsing.OrderBy orderBy = new com.yahoo.bullet.parsing.OrderBy(); orderBy.setType(PostAggregation.Type.ORDER_BY); orderBy.setFields(fields); return orderBy; } }