Skip to main content

cmp_pk_unsigned_aware

Function cmp_pk_unsigned_aware 

Source
pub(crate) fn cmp_pk_unsigned_aware<'a>(
    lhs: impl Iterator<Item = DatumRef<'a>>,
    rhs: impl Iterator<Item = DatumRef<'a>>,
    pk_order: &[OrderType],
    pk_needs_unsigned_i64_compare: &[bool],
) -> Ordering
Expand description

Compare two primary-key rows column by column, recovering the upstream unsigned order for BIGINT UNSIGNED pk columns.

pk_needs_unsigned_i64_compare[i] is true only for upstream BIGINT UNSIGNED. Frontend up-casts narrower unsigned integers so they stay non-negative in RisingWave, and unsigned float/double/decimal types must keep their native comparison semantics. Only BIGINT UNSIGNED can overflow into a negative i64, so we reinterpret both sides as u64 to restore upstream MySQL ordering. The ScalarRefImpl::Int64 match below is a defensive guard for that contract.