Page MenuHomePhabricator

hint:runFirst throws exception
Open, LowPublic

Description

According to QueryHints, hint:runFirst should allow specifying that a particular join should run first in a join group, for example:

SELECT ?item WHERE {
  ?item wdt:P131* wd:Q1198. hint:Prior hint:runFirst true.
  ?item wdt:P31/wdt:P279* wd:Q387917.
}

However, it doesn’t work:

com.bigdata.rdf.sparql.ast.hints.QueryHintException: scope=Prior, name=runFirst, value=true, op=PropertyPathNode
at com.bigdata.rdf.sparql.ast.hints.RunFirstHint.handle(RunFirstHint.java:66)
at com.bigdata.rdf.sparql.ast.hints.RunFirstHint.handle(RunFirstHint.java:45)
at com.bigdata.rdf.sparql.ast.optimizers.ASTQueryHintOptimizer._applyQueryHint(ASTQueryHintOptimizer.java:304)
at com.bigdata.rdf.sparql.ast.optimizers.ASTQueryHintOptimizer.applyQueryHint(ASTQueryHintOptimizer.java:701)
at com.bigdata.rdf.sparql.ast.optimizers.ASTQueryHintOptimizer.processGroup(ASTQueryHintOptimizer.java:419)
at com.bigdata.rdf.sparql.ast.optimizers.ASTQueryHintOptimizer.optimize(ASTQueryHintOptimizer.java:155)

I also tried "true" and "true"^^xsd:boolean as arguments, with the same result. (The last one should be identical to true AFAIK, but who knows what the optimizer does with them…)

(This example query can be made to run by completely disabling the optimizer, but in general it would be nice to have more fine-grained control over it.)

hint:runLast has the same problem.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

What it complains about is that hint:runFirst is applicable only to joins, but ?item wdt:P131* wd:Q1198 is not a join. Not sure why exactly it is the case though, need to check.

It is possible to make this query parse, but it still times out.

This one seems to work:

SELECT ?item WHERE {
  hint:Query hint:optimizer "None" .
  ?item wdt:P131* wd:Q1198. 
  ?item wdt:P31/wdt:P279* wd:Q387917.
}

Yes, that’s what I meant with:

(This example query can be made to run by completely disabling the optimizer, but in general it would be nice to have more fine-grained control over it.)