NaturalExprValueComparators

Provides a total, natural ordering over ExprValue. This ordering is consistent with ExprValue.exprEquals with the exception that NULL and MISSING compare with themselves and have order. PartiQL treats Ion typed nulls as NULL for the purposes of comparisons and Ion annotations are not considered for comparison purposes.

The ordering rules are as follows:

  • NULL and MISSING are always first or last and compare equally. In other words, comparison cannot distinguish between NULL or MISSING.

  • The BOOL values follow with false coming before true.

  • The ExprValueType.isNumber types come next ordered by their numerical value irrespective of precision or specific type. For FLOAT special values, nan comes before -inf, which comes before all normal numeric values, which is followed by +inf.

  • DATE values follow and are compared by the date from earliest to latest.

  • TIME values follow and are compared by the time of the day (point of time in a day of 24 hours) from earliest to latest. Note that time without time zone is not directly comparable with time with time zone. However, time without time zone value comes before time with time zone value when compared in the natural order.

  • TIMESTAMP values follow and are compared by the point of time irrespective of precision and local UTC offset.

  • The ExprValueType.isText types come next ordered by their lexicographical ordering by Unicode scalar irrespective of their specific type.

  • The ExprValueType.isLob types follow and are ordered by their lexicographical ordering by octet.

  • LIST comes next, and their values compare lexicographically based on their child elements recursively based on this definition.

  • SEXP follows and compares within its type similar to LIST.

  • STRUCT values follow and compare lexicographically based on the sorted (as defined by this definition) members, as pairs of field name and the member value.

  • BAG values come finally (except with NullOrder.NULLS_LAST), and their values compare lexicographically based on the sorted child elements.

Parameters

order

that compares left and right values by Order.ASC (ascending) or Order.DESC (descending) order

nullOrder

that places NULL/MISSING values first or last

Entries

Link copied to clipboard
NULLS_LAST_DESC(Order.DESC, NullOrder.LAST)
Link copied to clipboard
NULLS_LAST_ASC(Order.ASC, NullOrder.LAST)
Link copied to clipboard
NULLS_FIRST_DESC(Order.DESC, NullOrder.FIRST)
Link copied to clipboard
NULLS_FIRST_ASC(Order.ASC, NullOrder.FIRST)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun compare(left: ExprValue, right: ExprValue): Int
Link copied to clipboard
open fun reversed(): Comparator<ExprValue>
Link copied to clipboard
open fun thenComparing(p0: Comparator<in ExprValue>): Comparator<ExprValue>
open fun <U : Comparable<U>> thenComparing(p0: Function<in ExprValue, out U>): Comparator<ExprValue>
open fun <U : Any> thenComparing(p0: Function<in ExprValue, out U>, p1: Comparator<in U>): Comparator<ExprValue>
Link copied to clipboard
open fun thenComparingDouble(p0: ToDoubleFunction<in ExprValue>): Comparator<ExprValue>
Link copied to clipboard
open fun thenComparingInt(p0: ToIntFunction<in ExprValue>): Comparator<ExprValue>
Link copied to clipboard
open fun thenComparingLong(p0: ToLongFunction<in ExprValue>): Comparator<ExprValue>

Properties

Link copied to clipboard
val name: String
Link copied to clipboard
val ordinal: Int