Skip to content
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

ORDER BY changes result size when combined with DISTINCT #38

Closed
niklas88 opened this issue Feb 26, 2018 · 1 comment
Closed

ORDER BY changes result size when combined with DISTINCT #38

niklas88 opened this issue Feb 26, 2018 · 1 comment
Projects

Comments

@niklas88
Copy link
Member

This was found by Tobias Matysiak: For queries with multiple columns adding an ORDER BY clause can change the result set.

See for example the following query with and without ORDER BY

PREFIX fb: <http://rdf.freebase.com/ns/>
SELECT DISTINCT ?cityname ?popcount WHERE {
    ?city fb:type.object.type fb:location.citytown .
    ?city fb:type.object.name ?cityname .
    ?city fb:location.location.containedby ?country .
    ?city fb:location.statistical_region.population ?population .
    ?population fb:measurement_unit.dated_integer.number ?popcount .
}
ORDER BY DESC(?popcount)
LIMIT 100

My guess is that DISTINCT needs to sort by all columns combined before any ORDER BY sorting if it should give really distinct results. Will have to check with the standards documents if this is actually what DISTINCT does. @Buchhold any quick knowledge?

@niklas88
Copy link
Member Author

This was fixed in #133 and I just confirmed it now works as expected

QLever automation moved this from To do to Done Mar 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
QLever
  
Done
Development

No branches or pull requests

1 participant