wgtmac commented on code in PR #861:
URL: https://github.com/apache/iceberg-cpp/pull/861#discussion_r3699642785
##########
src/iceberg/expression/literal.cc:
##########
@@ -444,7 +444,9 @@ std::strong_ordering CompareFloat(T lhs, T rhs) {
// and -NAN < NAN.
bool lhs_is_negative = std::signbit(lhs);
bool rhs_is_negative = std::signbit(rhs);
- return lhs_is_negative <=> rhs_is_negative;
+ // A negative sign bit sorts below a positive one (-NaN < +NaN), so a
+ // negative operand must compare as less.
+ return rhs_is_negative <=> lhs_is_negative;
Review Comment:
I would argue that NaN should not actually appear as a `Literal`. This
applies to both lower/upper bounds and expression literal. It is recommended
to use `HasNaN` and `NotHasNaN` predicates for NaN values.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]