qEndpoint
qEndpoint copied to clipboard
ORDER BY not working with activated optimizer
Part of the endpoint? (leave empty if you don't know)
- [ ] Backend (qendpoint-backend)
- [X] Store (qendpoint-backend)
- [ ] Core (qendpoint-core)
- [ ] Frontend (qendpoint-frontend)
- [ ] Other
Description of the issue
Any query with ORDER BY
doesn't work, e.g.
SELECT ?s WHERE {
VALUES ?s {1 2 3 4 5}
} ORDER BY DESC(?s)
returns
1
2
3
4
5
Deactivating the OrderLimitOptimizer
in EndpointStoreQueryPreparer
class makes sorting work, so I assume it's a combination of how RDF4J does replace child and parent nodes (probably line 68 in OrderLimitOptimizer
class) in the corresponding optimizer and how you consume the optimized TupleExpr
in the ExtendedEvaluationStrategy
?
You can also see from the query plan that something is wrong and the sorting part has been dropped somehow
ProjectionElem "s"
ProjectionElemList
BindingSetAssignment ([[s="1"^^<http://www.w3.org/2001/XMLSchema#integer>], [s="2"^^<http://www.w3.org/2001/XMLSchema#integer>], [s="3"^^<http://www.w3.org/2001/XMLSchema#integer>], [s="4"^^<http://www.w3.org/2001/XMLSchema#integer>], [s="5"^^<http://www.w3.org/2001/XMLSchema#integer>]])
Projection
Excepted behavior
correct result:
5
4
3
2
1
Obtained behavior
wrong result:
1
2
3
4
5
How to reproduce
- Run
Application
class from source code or Docker image - Execute
SELECT ?s WHERE {
VALUES ?s {1 2 3 4 5}
} ORDER BY DESC(?s)
Endpoint version
1.13.8
Do I want to contribute to fix it?
No
Something else?
No response