/** * Constructs a numeric sort of the given metric and explicitly specifies the order (ascending or descending). * * @param metricName the metric name * @param order sorting order */ public TopNMetric(String metricName, SortDirection order) { this(metricName); if (order == SortDirection.ASC) { this.type = TopNMetricType.INVERTED; this.metricName = Optional.empty(); this.nested = Optional.of(new TopNMetric(metricName)); } }
/** * Constructs a sort of the given type with a starting point and explicitly specifies the order (ascending or * descending). * * @param type the type of sort * @param previousStop the starting point of the sort * @param order sorting order */ public TopNMetric(TopNMetricType type, String previousStop, SortDirection order) { this(type, previousStop); if (order == SortDirection.ASC) { this.type = TopNMetricType.INVERTED; this.nested = Optional.of(new TopNMetric(type, previousStop)); this.previousStop = Optional.empty(); } }
druidOrderBy = null; OrderByColumn sortBy = request.getSorts().iterator().next(); druidTopNMetric = new TopNMetric(sortBy.getDimension(), sortBy.getDirection()); } else if (request.getSorts().size() > 0) { druidOrderBy = new LimitSpec(request.getSorts());