LuciferYang opened a new pull request, #861:
URL: https://github.com/apache/iceberg-cpp/pull/861

   ## What
   
   `Literal::operator<=>` orders a negative NaN as greater than a positive NaN, 
the opposite of the total ordering documented and tested in this file. 
`CompareFloat` returns `lhs_is_negative <=> rhs_is_negative` for the both-NaN 
case, so `-NaN <=> +NaN` is `true <=> false` = `greater`. The adjacent comment 
says "-NAN < NAN", and `FloatSpecialValuesComparison` / 
`DoubleSpecialValuesComparison` assert `-NaN < -Infinity < ... < +Infinity < 
+NaN`, both of which this branch contradicts.
   
   Fixes #860.
   
   ## How
   
   Swap the operands so a negative sign bit sorts below a positive one:
   
   ```cpp
   return rhs_is_negative <=> lhs_is_negative;
   ```
   
   ## Testing
   
   The existing `FloatNaNComparison` / `DoubleNaNComparison` tests only cover 
same-sign NaN pairs (qNaN vs sNaN, which are equivalent), so the mixed-sign 
case was unexercised. Added `FloatSignedNaNComparison` and 
`DoubleSignedNaNComparison` asserting `-NaN < +NaN` and the reverse. Verified 
fail-without (the new tests report `greater`/`less` swapped) / pass-with. Full 
`expression_test` passes (495 tests).
   


-- 
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]

Reply via email to