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

Misleading not groupable error on query that tries to group by an aggregate #506

Closed
dpriskorn opened this issue Oct 27, 2021 · 3 comments
Closed

Comments

@dpriskorn
Copy link

Does anyone know why this fails?

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wikibase: <http://wikiba.se/ontology#>
#title:Medicines ordered by the most studied 
SELECT ?main_subject (count(?item) as ?c)
WHERE 
{
  ?item wdt:P31 wd:Q13442814;
        wdt:P921 ?main_subject.
  ?main_subject wdt:P31/wdt:P279* wd:Q12140.
}
group by ?main_subject ?c

"Exception: BAD QUERY (Groupby variable ?main_subject is not groupable; in ../src/engine/GroupBy.cpp, line 704, function virtual void GroupBy::computeResult(ResultTable*))"

Here is a similar query that works on WDQS

@hannahbast
Copy link
Member

The ?c in the GROUP BY looks strange. We were not aware that this is valid SPARQL.

However, the result is exactly the same (also on the WDQS) when you remove the ?c from the GROUP BY.

Without the ?c, the query also works on QLever, just 40 times faster.

@bpelakh
Copy link

bpelakh commented Nov 4, 2021

I agree with @hannahbast , I don't think it's valid to group by an aggregate (which is only derived from the first grouping). The error message is misleading, however, and that should be fixed.

@dpriskorn dpriskorn changed the title Not groupable error on query that works on BlazeGraph Misleading not groupable error on query that tries to group by an aggregate Jan 30, 2022
@hannahbast
Copy link
Member

This is fixed, the error message is now "GROUP BY variable ?c is not groupable"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants