IgnatiusPang commented on PR #25746:
URL: https://github.com/apache/datafusion/pull/25746#issuecomment-5966848222

   > Thanks for the fix!
   > 
   > There seems to be another ordering edge case when negative inputs produce 
`NaN`, even with a base greater than 1:
   > 
   > ```sql
   > SELECT x, log(2.0, x) AS l
   > FROM (
   >   SELECT x
   >   FROM (VALUES (-1.0), (1.0), (4.0)) AS t(x)
   >   ORDER BY x
   >   LIMIT 3
   > )
   > ORDER BY l ASC;
   > ```
   > 
   > The outer sort is removed, returning `l` as `NaN, 0, 2` instead of `0, 2, 
NaN`.
   > 
   > This is pre-existing, so I don’t think it needs to block this PR. Maybe we 
could open a follow-up issue to track it?
   
   Thanks, good find. The single-argument functions (ln, log2, log10, sqrt) 
only claim an ordering when their input is provably ≥ 0, but log never checks 
x. I've opened #25991 as a draft that adds the same check. It's stacked on this 
PR and changes the base > 1 plan here, so I'll keep it separate and pick it up 
once this one merges.


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