Natural Expr Value Comparators
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
andMISSING
are always first or last and compare equally. In other words, comparison cannot distinguish betweenNULL
orMISSING
.The
BOOL
values follow withfalse
coming beforetrue
.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 toLIST
.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
that compares left and right values by Order.ASC (ascending) or Order.DESC (descending) order
that places NULL
/MISSING
values first or last