jackrabbit-oak icon indicating copy to clipboard operation
jackrabbit-oak copied to clipboard

OAK-8711 - Queries with facets should not use traversal

Open averma21 opened this issue 5 years ago • 5 comments

averma21 avatar Jan 27 '20 08:01 averma21

@nit0906 QueryResult#getRows() throws exception even without my changes since TraversingCursor doesn't work with facets. So what should be the test flow?

averma21 avatar Jan 31 '20 10:01 averma21

@nit0906 QueryResult#getRows() throws exception even without my changes since TraversingCursor doesn't work with facets. So what should be the test flow?

Yes - so we need to create a test to check that if there is a index present to serve the query then TraversingCursor should not be picked up.

So the test flow should be something where without your fix TraversingCursor is picked up and ends up in exception (and hence the test fails) but with your fix the actual index will pick up and serve the facet query.

nit0906 avatar Jan 31 '20 15:01 nit0906

Actually I am not very sure what the intent of that test would be. Since we are now returning infinity as a cost for traversal in case of facets query, I think traversal would never be picked up in that case. To me it seems that writing the other test would mean that we are checking that a higher cost index is not picked up if a lower cost index is present and I hope that logic should already be tested elsewhere.

averma21 avatar Jan 31 '20 19:01 averma21

The patch does contain a test case that (to me) seems to address the comment from @nit0906 . Or maybe I misunderstood the comment?

Other than that, the patch looks good to me.

thomasmueller avatar Feb 04 '20 13:02 thomasmueller

The test sort of handles what I was asking for - basically a condition where traversal would have a lower cost than an index but the expected flow would be that index gets picked up instead of traversal (because traversal in this case would throw an exception.) So I think we are good.

nit0906 avatar Feb 05 '20 09:02 nit0906

This PR is stale because it has been open 24 months with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Nov 12 '22 02:11 github-actions[bot]