-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong result on using limit after order by on null data #3015
Comments
I have tried some stuff to reproduce, but haven't succeeded yet. There is a difference between the two queries: the first one is optimized into a TopN operator, the second one is an Order with a Limit on top. It could be that there is an issue with the TopN operator with NULLS. |
@Jedi18 could you try to make a reproducible example? |
Sure, here you go https://drive.google.com/file/d/1exn7shxeXxUQWmIVpXZjSljtZK4cDuhX/view?usp=sharing . I've included the data I encountered this bug on. If you diff the two output files, you'll see they have a few different rows. |
Thanks for the reproducible example! I think I have tracked down the bug and fixed it in #3040. |
@Mytherin That's great! Thanks a lot for fixing it! |
Whoops sorry for closing the issue, I thought the PR was merged. |
Fix #3015: fix edge case issue with many null values in physical Top N
Should be fixed now :) |
What happens?
Several row values are missing (when compared with the same query on other SQL engines) when using limit in the below given query. I'm not a 100% sure whether this is a bug or this is the intended behaviour. Note that this happens on data with null values.
To Reproduce
This gives the wrong result. To get the correct result, I had to change the query to the one given below
Environment (please complete the following information):
Before Submitting
master
branch?pip install duckdb --upgrade --pre
install.packages("https://github.com/duckdb/duckdb/releases/download/master-builds/duckdb_r_src.tar.gz", repos = NULL)
The text was updated successfully, but these errors were encountered: