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

Andy Seaborne commented on JENA-294:
------------------------------------

The new patch causes errors in the test suite. 

I constructed this example where the ?x :p ?o part does match the data.

Data:
:x :p 123 .

Query:
SELECT *
{
   ?x :p ?o .
   OPTIONAL { ?x :q1 ?o }
   FILTER(?x = :x)
}

gives the wrong answers.  If the left side matches and the right side does not, 
then no assignment is done but the (bgp (triple :x :p ?o)) has been rewritten.

  (conditional
    (bgp (triple :x :p ?o))
    (assign ((?x :x))
      (bgp (triple :x :q1 ?o)))))

The problem is that pushing the assign in always means that the fixed (left) 
part of the optional misses it.  A hack to push if and only if the left is a 
unit table works in this one example but I'm not sure about more complex cases 
yet.

It is essential we have a test suite so we can be sure we do not end up 
breaking existing correct behavior.  I'll create one.

Pushing inwards when the other side has unrelated variables would generalize 
the optimization (which, incidentally, would be good for filters as well).

                
> TransformFilterEquality does not handle starting OPTIONAL well
> --------------------------------------------------------------
>
>                 Key: JENA-294
>                 URL: https://issues.apache.org/jira/browse/JENA-294
>             Project: Apache Jena
>          Issue Type: Improvement
>          Components: ARQ
>    Affects Versions: Jena 2.7.4
>            Reporter: Simon Helsen
>         Attachments: patch.txt, patch.txt
>
>
> There was one other case where our tests were stuck on a very slow query 
> execution because transformFilterEquality failed to optimize. The problem is 
> that the optimizer gives up whenever the WHERE clause starts with an OPTIONAL 
> clause. The reason is that the generated algebraic formula starts with a 
> TableUnit and this is not handled correctly. 
> I have attached a patch which fixes the problem

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to