Andy Seaborne created JENA-881:
----------------------------------

             Summary: Leaking from scope or dropping of filter expressions
                 Key: JENA-881
                 URL: https://issues.apache.org/jira/browse/JENA-881
             Project: Apache Jena
          Issue Type: Bug
          Components: ARQ, Optimizer
    Affects Versions: Jena 2.12.1, Jena 2.12.0, Jena 2.11.2
            Reporter: Andy Seaborne
            Assignee: Andy Seaborne
             Fix For: Jena 2.13.0


This query (much reduced from a real example):

{noformat}
SELECT  *
WHERE
  {   { FILTER ( false ) }
    UNION
      { FILTER ( ?z != 3 ) }
    FILTER ( true )
  }
{noformat}
generates this algebra before optimization (specifically, filter placement):
{noformat}
(filter true
  (union
    (filter false
      (table unit))
    (filter (!= ?z 3)
      (table unit)))))
{noformat}
which is mis-optimized into:
{noformat}
(union
  (filter (exprlist false true)
    (table unit))
  (filter true
    (table unit)))
{noformat}
and gives a result of one row when it should be zero rows.  This is because
the {{(!= ?z 3)}} has been lost.

Other cases leak the filter from its place in the tree:
{noformat}
(filter (!= ?x 4)
  (extend ((?z 6))
    (filter (= ?z 3)
      (table unit))))
{noformat}
becomes:
{noformat}
(filter (exprlist (= ?z 3) (!= ?x 4))
  (extend ((?z 6))
    (table unit)))
{noformat}
which is wrong because the {{(= ?z 3)}} has moved outwards over the {{extend}}.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to