[ 
https://issues.apache.org/jira/browse/OAK-12007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18040256#comment-18040256
 ] 

Thomas Mueller edited comment on OAK-12007 at 11/24/25 10:14 AM:
-----------------------------------------------------------------

oak-lucene failures:
{noformat}
[ERROR]   
FacetTest>AbstractJCRTest.run:476->testDistinctUnionWithDifferentFacetsOnSubQueries:814
 expected:<2> but was:<0>
String xpath = "//*[@text = 't1' or @name = 'Node1']/(rep:facet(text))";
        Query q = qm.createQuery(xpath, Query.XPATH);
        RowIterator rows=q.execute().getRows();
        assertEquals(2, rows.getSize());

[ERROR]   
FacetTest>AbstractJCRTest.run:476->testMergedFacetsOverUnionSummingCount:916 
Unexpected dimensions expected:<[text]> but was:<[]>
String xpath = "//*[@x1 = 'v1' or @x2 = 'v2']/(rep:facet(text))";
Query q = qm.createQuery(xpath, Query.XPATH);
FacetResult facetResult = new FacetResult(q.execute());

[ERROR]   
FacetTest>AbstractJCRTest.run:476->testMergedFacetsOverUnionUniqueLabels:841 
Unexpected dimensions expected:<[text]> but was:<[]>
String xpath = "//*[@name = 'Node1' or @text = 't2' or @x = 
'x3']/(rep:facet(text))";
FacetResult facetResult = new FacetResult(q.execute());
assertEquals("Unexpected dimensions", Set.of("text"), 
facetResult.getDimensions());

[ERROR]   
ResultSizeTest>AbstractJCRTest.run:476->testResultSize:35->doTestResultSize:63->doTestResultSize:97
 size: 200 expected around 400
if (union) {
    xpath = "/jcr:root//*[jcr:contains(@text, 'Hello') or jcr:contains(@text, 
'World')]";
} else {
    xpath = "/jcr:root//*[jcr:contains(@text, 'Hello World')]";
}

[ERROR]   
WhiteboardResultSizeTest.testResultSize:134->doTestResultSize:142->doTestResultSize:174
 size: 200 expected around 400
if (union) {
    xpath = "/jcr:root//*[jcr:contains(@text, 'Hello') or jcr:contains(@text, 
'World')]";
} else {
    xpath = "/jcr:root//*[jcr:contains(@text, 'Hello World')]";
}

[ERROR]   
LuceneIndexAggregation2Test>IndexAggregation2CommonTest.oak2249:220->IndexAggregation2CommonTest.assertEventually:393
 Condition not satisfied after 15.09 seconds and 142 attempts

expected:
[ERROR]   LucenePropertyIndexTest.unionSortResultCount:1780 
Expected: a string containing "scanCount: 101"
     but: was "selector: query scanCount: 100 "
{noformat}



was (Author: tmueller):
oak-lucene failures:
{noformat}
[ERROR]   
FacetTest>AbstractJCRTest.run:476->testDistinctUnionWithDifferentFacetsOnSubQueries:814
 expected:<2> but was:<0>

[ERROR]   
FacetTest>AbstractJCRTest.run:476->testMergedFacetsOverUnionSummingCount:916 
Unexpected dimensions expected:<[text]> but was:<[]>

[ERROR]   
FacetTest>AbstractJCRTest.run:476->testMergedFacetsOverUnionUniqueLabels:841 
Unexpected dimensions expected:<[text]> but was:<[]>

[ERROR]   
ResultSizeTest>AbstractJCRTest.run:476->testResultSize:35->doTestResultSize:63->doTestResultSize:97
 size: 200 expected around 400

[ERROR]   
WhiteboardResultSizeTest.testResultSize:134->doTestResultSize:142->doTestResultSize:174
 size: 200 expected around 400

[ERROR]   
LuceneIndexAggregation2Test>IndexAggregation2CommonTest.oak2249:220->IndexAggregation2CommonTest.assertEventually:393
 Condition not satisfied after 15.09 seconds and 142 attempts

expected:
[ERROR]   LucenePropertyIndexTest.unionSortResultCount:1780 
Expected: a string containing "scanCount: 101"
     but: was "selector: query scanCount: 100 "
{noformat}


> XPath with "or" conditions should not always be converted to "union"
> --------------------------------------------------------------------
>
>                 Key: OAK-12007
>                 URL: https://issues.apache.org/jira/browse/OAK-12007
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: query
>            Reporter: Thomas Mueller
>            Priority: Major
>
> In OAK-1432, XPath queries with "or" conditions are always converted to 
> "union" queries.
> There are some queries that do not benefit from this forced conversion to 
> "union", for example queries that use elasticsearch indexes for both parts, 
> but where one of the properties is not indexed. In general, it would be 
> better to compare the cost of the union with the cost of the non-union query, 
> and then pick the one with the lower cost.
> In fact, for SQL-2 queries with "or" conditions, that is how it's working 
> since OAK-1617.
> It's a bit dangerous now (after such a long time) to always disable the 
> forced "union" conversion for XPath queries. But, what we could do is disable 
> the forced conversion using a feature toggle.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to