Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-432

Filter optimization messes up when a nested select is present in the same block

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Jena 2.10.0
    • Jena 2.10.1, Jena 2.11.1
    • ARQ, Optimizer
    • None

    Description

      The following test query:

      SELECT ?test ?s1
      WHERE {
        ?test ?p1 ?o1.
        FILTER ( ?test = <http://localhost/t1> || ?test = <http://localhost/t2> )  
        OPTIONAL {
          SELECT ?s1
          { ?s1 ?p2 ?o2 }
        }
      }
      

      produces the following plan:

      (project (?test ?s1)
        (disjunction
          (table empty)
          (table empty)))
      

      Something goes wrong with the FILTER expansion. As a workaround, we observed that the following variation:

      SELECT ?test ?s1
      WHERE {
        { ?test ?p1 ?o1.
          FILTER ( ?test = <http://localhost/t1> || ?test = <http://localhost/t2> )  
        }
        OPTIONAL {
          SELECT ?s1
          { ?s1 ?p2 ?o2 }
        }
      }
      

      produces the correct plan:

      (project (?test ?s1)
        (leftjoin
          (disjunction
            (assign ((?test <http://localhost/t1>))
              (bgp (triple <http://localhost/t1> ?p1 ?o1)))
            (assign ((?test <http://localhost/t2>))
              (bgp (triple <http://localhost/t2> ?p1 ?o1))))
          (project (?s1)
            (bgp (triple ?s1 ?/p2 ?/o2)))))
      

      Attachments

        Issue Links

          Activity

            People

              andy Andy Seaborne
              shelsen Simon Helsen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: