/** * @param fetch limit to fetch * @param collationIndexes index of fields as listed in query row output * @param collationDirections direction of sort * @param numericCollationIndexes flag of to determine sort comparator * @param queryOutputFieldNames query output fields * * @return always an non null Json Limit object */ private JsonLimit computeSort(@Nullable Integer fetch, List<Integer> collationIndexes, List<Direction> collationDirections, ImmutableBitSet numericCollationIndexes, List<String> queryOutputFieldNames) { final List<JsonCollation> collations; if (collationIndexes != null) { assert collationDirections != null; ImmutableList.Builder<JsonCollation> colBuilder = ImmutableList.builder(); for (Pair<Integer, Direction> p : Pair.zip(collationIndexes, collationDirections)) { final String dimensionOrder = numericCollationIndexes.get(p.left) ? "numeric" : "lexicographic"; colBuilder.add( new JsonCollation(queryOutputFieldNames.get(p.left), p.right == Direction.DESCENDING ? "descending" : "ascending", dimensionOrder)); } collations = colBuilder.build(); } else { collations = null; } return new JsonLimit("default", fetch, collations); }
: "alphanumeric"; colBuilder.add( new JsonCollation(fieldNames.get(p.left), p.right == Direction.DESCENDING ? "descending" : "ascending", dimensionOrder)); if (p.left >= groupSet.cardinality() && p.right == Direction.DESCENDING) {