Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Proposed Changes

According to KIP-969968, this KIP introduces the isKeyAscending variable public enum ResultOrder to determine whether keys are sorted in ascending or descending  or unordered order. Order is based on the serialized byte[] of the keys, not the 'logical' key order. It employs the withDescendingKeys() and withAscendingKeys() method methods to specify that the keys should be ordered in descending or ascending or unordered sequence, and the isKeyAscendingresultOrder() method to retrieve the value of isKeyAscendingenum value in  ResultOrder. I've incorporated these variables and methods into the RangeQuery class and modified some method inputs. As a result, we can now use withDescendingKeys() to obtain results in reverse order and use withAscendingKeys to obtain the result in ascending order.

Code Block
/**
 * Interactive query for issuing range queries and scans over KeyValue stores.
 * <p>
 *  A range query retrieves a set of records, specified using an upper and/or lower bound on the keys.
 * <p>
 * A scan query retrieves all records contained in the store.
 * <p>
 */
@Evolving
public final class RangeQuery<K, V> implements Query<KeyValueIterator<K, V>> {
    ...  

	/**
     *  private final boolean isKeyAscending;

    /**Determines if the serialized byte[] of the keys in ascending or descending or unordered order.
     * Order is Determinesbased ifon the query serialized byte[] of the keys, not arethe in'logical' ascendingkey order.
     * @return true if ascending, false otherwise return the order of returned records based on the serialized byte[] of the keys (can be unordered, or in ascending or in descending order).
     */
    public booleanResultOrder isKeyAscendingresultOrder(); 

    /**
     * Set the query to return the serialized byte[] of the keys in descending order.
     * Order is based on the serialized byte[] of the keys, not the 'logical' key order.
     * @return a new RangeQuery instance with descending flag set.
     */
    public RangeQuery<K, V> withDescendingKeys() 

    /**
     * Set the query to return the serialized byte[] of the keys in descending ascending order.
     * Order is based on the serialized byte[] of the keys, not the 'logical' key order.
     * @return a new RangeQuery instance with descendingascending flag set.
     */
    public RangeQuery<K, V> withDescendingKeyswithAscendingKeys();

       ...
}

According to KIP-968, we introduce a public enum ResultOrder.

ResultOrder enum
It helps with specifying the order of the returned results by the query.

...