public void addColumnForOrdering(ColumnDefinition c) { if (orderingIndex == null) orderingIndex = new LinkedHashMap<>(); int index = getResultSetIndex(c); if (index < 0) index = addOrderingColumn(c); orderingIndex.put(c, index); }
public void addColumnForOrdering(ColumnDefinition c) { if (orderingIndex == null) orderingIndex = new LinkedHashMap<>(); int index = getResultSetIndex(c); if (index < 0) index = addOrderingColumn(c); orderingIndex.put(c, index); }
private Map<ColumnIdentifier, Integer> getOrderingIndex(CFMetaData cfm, Selection selection) throws InvalidRequestException { // If we order post-query (see orderResults), the sorted column needs to be in the ResultSet for sorting, // even if we don't // ultimately ship them to the client (CASSANDRA-4911). Map<ColumnIdentifier, Integer> orderingIndexes = new HashMap<>(); for (ColumnDefinition.Raw raw : parameters.orderings.keySet()) { final ColumnDefinition def = raw.prepare(cfm); int index = selection.getResultSetIndex(def); if (index < 0) index = selection.addColumnForOrdering(def); orderingIndexes.put(def.name, index); } return orderingIndexes; }