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

Thomas Mueller commented on OAK-12007:
--------------------------------------

When the feature toggle is enabled, the following tests in oak-core fail (as 
expected):

 
{noformat}
[ERROR] Failures: 
[ERROR]   XPathToSQL2Test.testComplexNestedOrFeatureDisabled:101->verify:161 
    expected:<.... where [a] = 1 and [[b] = 2 union select ... where [a] = 1 
and [c] = 3 union select ... where] [d] = 4 > 
    but was:<.... where [a] = 1 and [([b] = 2 or [c] = 3) or] [d] = 4 >

[ERROR]   
XPathToSQL2Test.testMultipleOrConditionsFeatureDisabled:53->verify:161 
    expected:<...t ... where [a] = 1 [union select ... where [b] = 2 union 
select ... where] [c] = 3 > 
    but was:<...t ... where [a] = 1 [or [b] = 2 or] [c] = 3 >

[ERROR]   XPathToSQL2Test.testNestedOrWithAndFeatureDisabled:69->verify:161 
    expected:<.... where [x] = 1 and [[a] = 1 union select ... where [x] = 1 
and [b] = 2] > 
    but was:<.... where [x] = 1 and [([a] = 1 or [b] = 2)] >

[ERROR]   XPathToSQL2Test.testOrToUnionConversionFeatureDisabled:37->verify:161 
    expected:<...t ... where [a] = 1 [union select ... where] [b] = 2 > 
    but was:<...t ... where [a] = 1 [or] [b] = 2 >

[ERROR]   
XPathToSQL2Test.testOrWithDifferentPathsFeatureDisabled:117->verify:161 
    expected:<...re [title] = 'Test' [union select ... where] [desc] = 'Test' > 
    but was:<...re [title] = 'Test' [or] [desc] = 'Test' >

[ERROR]   XPathToSQL2Test.testOrWithFunctionCallFeatureDisabled:133->verify:161 
    expected:<...contains(*, 'test') [union select ... where] [type] = 'page' > 
    but was:<...contains(*, 'test') [or] [type] = 'page' > 
{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