-
Notifications
You must be signed in to change notification settings - Fork 175
Description
It seems that there is a bug in constructing the tuple expression for queries with aggregations. E.g., this code throws an exception:
String query =
"""
SELECT (COUNT(?s) AS ?count)
WHERE { ?s ?p ?o }
""";
TupleExpr expr = new SPARQLParser().parseQuery(query, null).getTupleExpr();
new ParentReferenceChecker(null).optimize(expr, new SimpleDataset(), new EmptyBindingSet());
The exception message:
java.lang.AssertionError: After query parsing there was an unexpected parent for node Count
Var (name=s)
: ExtensionElem (count)
Count
Var (name=s)
(expected GroupElem (count)
Count
Var (name=s)
)
There aren't any issues with the query execution. But it does cause issues with optimisers that e.g. replace nodes. The exact 'location' the parent reference is mixed up seems to depend on the query 'shape' a bit. E.g., with a more complex expression in the projection like SELECT (COUNT(?s)/30 AS ?count)
it's the ?s ?p ?o
StatementPattern that gets the wrong parent reference.
Version
4.3.8
Are you interested in contributing a solution yourself?
Perhaps?
Copilot
Metadata
Metadata
Assignees
Labels
🐞 bugissue is a bugissue is a bug