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 not working with activated optimizer #430

Open
1 of 5 tasks
LorenzBuehmann opened this issue Oct 30, 2023 · 0 comments
Open
1 of 5 tasks

ORDER BY not working with activated optimizer #430

LorenzBuehmann opened this issue Oct 30, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@LorenzBuehmann
Copy link

LorenzBuehmann commented Oct 30, 2023

Part of the endpoint? (leave empty if you don't know)

  • Backend (qendpoint-backend)
  • 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

  1. Run Application class from source code or Docker image
  2. 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

@LorenzBuehmann LorenzBuehmann added the bug Something isn't working label Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant