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

hint:Query hint:optimizer "None" ignored for Property Paths

    XMLWordPrintable

    Details

      Description

      Seems to be a case where this hint is not followed.

      base <https://swedish-qc.syapse.com/>
      prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
      prefix sci: </bdm/api/kbobject/sci:sci:>
      SELECT (count(*) as ?c)
      WHERE {
        hint:Query hint:optimizer "None" .
        ?PatientEncounter_C sci:hasLocation/sci:locationCD 'FH' . # 472742 
        ?PatientEncounter_C rdf:type sci:PatientEncounter . # 1993000
      }
      

      The optimized AST is the same whether we specify the location or type first.

      SELECT ( com.bigdata.rdf.sparql.ast.FunctionNode(VarNode(*))[ FunctionNode.scalarVals=null, FunctionNode.functionURI=http://www.w3.org/2006/sparql-functions#count, valueExpr=com.bigdata.bop.rdf.aggregate.COUNT(*)] AS VarNode(c) )
        JoinGroupNode [optimizer=None] {
          StatementPatternNode(VarNode(PatientEncounter_C), ConstantNode(Vocab(14)[http://www.w3.org/1999/02/22-rdf-syntax-ns#type]), ConstantNode(TermId(2859086U)[https://swedish-qc.syapse.com/bdm/api/kbobject/sci:sci:PatientEncounter])) [scope=DEFAULT_CONTEXTS]
            AST2BOpBase.estimatedCardinality=1993000
            AST2BOpBase.originalIndex=POCS
          StatementPatternNode(VarNode(PatientEncounter_C), ConstantNode(TermId(2858631U)[https://swedish-qc.syapse.com/bdm/api/kbobject/sci:sci:hasLocation]), VarNode(--pp-anon-c5d8407d-f954-4a85-9bcc-59e8911af68b)[anonymous]) [scope=DEFAULT_CONTEXTS]
            AST2BOpBase.estimatedCardinality=1993000
            AST2BOpBase.originalIndex=POCS
          StatementPatternNode(VarNode(--pp-anon-c5d8407d-f954-4a85-9bcc-59e8911af68b)[anonymous], ConstantNode(TermId(2858882U)[https://swedish-qc.syapse.com/bdm/api/kbobject/sci:sci:locationCD]), ConstantNode(TermId(2887745L)[FH])) [scope=DEFAULT_CONTEXTS]
            AST2BOpBase.estimatedCardinality=510155
            AST2BOpBase.originalIndex=POCS
        }
      

      However, if we enable the optimizer, the query now finishes in 7s. The optimized AST changes to put the location first.

      SELECT ( com.bigdata.rdf.sparql.ast.FunctionNode(VarNode(*))[ FunctionNode.scalarVals=null, FunctionNode.functionURI=http://www.w3.org/2006/sparql-functions#count, valueExpr=com.bigdata.bop.rdf.aggregate.COUNT(*)] AS VarNode(c) )
        JoinGroupNode {
          StatementPatternNode(VarNode(--pp-anon-327676aa-6dac-4396-9ff6-2f6e7abd3658)[anonymous], ConstantNode(TermId(2858882U)[https://swedish-qc.syapse.com/bdm/api/kbobject/sci:sci:locationCD]), ConstantNode(TermId(2887745L)[FH])) [scope=DEFAULT_CONTEXTS]
            AST2BOpBase.estimatedCardinality=510155
            AST2BOpBase.originalIndex=POCS
          StatementPatternNode(VarNode(PatientEncounter_C), ConstantNode(TermId(2858631U)[https://swedish-qc.syapse.com/bdm/api/kbobject/sci:sci:hasLocation]), VarNode(--pp-anon-327676aa-6dac-4396-9ff6-2f6e7abd3658)[anonymous]) [scope=DEFAULT_CONTEXTS]
            AST2BOpBase.estimatedCardinality=1993000
            AST2BOpBase.originalIndex=POCS
          StatementPatternNode(VarNode(PatientEncounter_C), ConstantNode(Vocab(14)[http://www.w3.org/1999/02/22-rdf-syntax-ns#type]), ConstantNode(TermId(2859086U)[https://swedish-qc.syapse.com/bdm/api/kbobject/sci:sci:PatientEncounter])) [scope=DEFAULT_CONTEXTS]
            AST2BOpBase.estimatedCardinality=1993000
            AST2BOpBase.originalIndex=POCS
        }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michaelschmidt michaelschmidt
              Reporter:
              nolanli Nolan Li
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: