File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
datafusion/common/src/scalar Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -4021,11 +4021,15 @@ impl ScalarValue {
40214021 arr1 == & right
40224022 }
40234023
4024- /// Compare `self` with `other` and return an `Ordering` .
4024+ /// Compare two `ScalarValue`s .
40254025 ///
4026- /// This is the same as [`PartialOrd`] except that it returns
4027- /// `Err` if the values cannot be compared, e.g., they have incompatible data types.
4028- pub fn try_cmp ( & self , other : & Self ) -> Result < Ordering > {
4026+ /// Returns an error if:
4027+ /// * the values are of incompatible types, or
4028+ /// * either value is NULL.
4029+ ///
4030+ /// This differs from `partial_cmp`, which returns `None` for NULL inputs
4031+ /// instead of an error.
4032+ pub fn try_cmp ( & self , other : & Self ) -> Result < Ordering > {
40294033 self . partial_cmp ( other) . ok_or_else ( || {
40304034 _internal_datafusion_err ! ( "Uncomparable values: {self:?}, {other:?}" )
40314035 } )
You can’t perform that action at this time.
0 commit comments