Uploaded image for project: 'Blazegraph (by SYSTAP)'
  1. Blazegraph (by SYSTAP)
  2. BLZG-979

unsound combo query optimization: union + filter

    XMLWordPrintable

    Details

      Description

      The optimization to push filters into unions takes place before the optimization that looks for unbound variables. Hence:

      SELECT *
      
      WHERE {
       ?D ?X ?C 
        FILTER( ?C > 10.0 )
        ?B ?Y ?C .
        
          { BIND ( <eg:a> AS ?D ) } UNION   { BIND ( <eg:b> AS ?D ) }
        
      }
      
      

      is optimized to

      QueryType: SELECT
      includeInferred=true
      SELECT VarNode(D) VarNode(X) VarNode(C) VarNode(B) VarNode(Y)
        JoinGroupNode {
          StatementPatternNode(VarNode(D), VarNode(X), VarNode(C)) [scope=DEFAULT_CONTEXTS]
            com.bigdata.rdf.sparql.ast.eval.AST2BOpBase.estimatedCardinality=83260
            com.bigdata.rdf.sparql.ast.eval.AST2BOpBase.originalIndex=SPOC
          StatementPatternNode(VarNode(B), VarNode(Y), VarNode(C)) [scope=DEFAULT_CONTEXTS]
            com.bigdata.rdf.sparql.ast.eval.AST2BOpBase.estimatedCardinality=83260
            com.bigdata.rdf.sparql.ast.eval.AST2BOpBase.originalIndex=SPOC
          UnionNode [joinVars=[]] [projectInVars=[D]] {
            JoinGroupNode [joinVars=[]] [projectInVars=[D]] {
              ( ConstantNode(TermId(0U)[eg:a]) AS VarNode(D) )
              FILTER( com.bigdata.rdf.sparql.ast.FunctionNode(VarNode(-unbound-var-C-0),ConstantNode(XSDDecimal(10.0)))[ com.bigdata.rdf.sparql.ast.FunctionNode.scalarVals=null, com.bigdata.rdf.sparql.ast.FunctionNode.functionURI=http://www.w3.org/2005/xpath-functions#greater-than, valueExpr=com.bigdata.rdf.internal.constraints.CompareBOp(-unbound-var-C-0,XSDDecimal(10.0))[ com.bigdata.rdf.internal.constraints.CompareBOp.op=GT]] )
            } JOIN ON ()
            JoinGroupNode [joinVars=[]] [projectInVars=[D]] {
              ( ConstantNode(TermId(0U)[eg:b]) AS VarNode(D) )
              FILTER( com.bigdata.rdf.sparql.ast.FunctionNode(VarNode(-unbound-var-C-0),ConstantNode(XSDDecimal(10.0)))[ com.bigdata.rdf.sparql.ast.FunctionNode.scalarVals=null, com.bigdata.rdf.sparql.ast.FunctionNode.functionURI=http://www.w3.org/2005/xpath-functions#greater-than, valueExpr=com.bigdata.rdf.internal.constraints.CompareBOp(-unbound-var-C-0,XSDDecimal(10.0))[ com.bigdata.rdf.internal.constraints.CompareBOp.op=GT]] )
            } JOIN ON ()
          } JOIN ON ()
        }
      

      which never succeeds

        Attachments

          Activity

            People

            Assignee:
            jeremycarroll jeremycarroll
            Reporter:
            jeremycarroll jeremycarroll
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: