Page MenuHomePhabricator

NPE when running query
Closed, ResolvedPublic1 Estimated Story Points

Description

This query:

prefix wikibase: <http://wikiba.se/ontology#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix wd: <http://www.wikidata.org/entity/>
prefix wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?wiki (count(?l) as ?lcount) WHERE {
  ?wiki wdt:P31 wd:Q10876391 .
  ?wiki rdfs:label ?l .
  SERVICE wikibase:language {
     bd:param wikibase:language "en" .
     ?wiki rdfs:label ?wikiLabel .
  }
} GROUP BY ?wiki
ORDER BY DESC(?lcount)

produces NPE:

java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:188)
	at com.bigdata.rdf.sail.webapp.BigdataServlet.submitApiTask(BigdataServlet.java:281)
	at com.bigdata.rdf.sail.webapp.QueryServlet.doSparqlQuery(QueryServlet.java:632)
	at com.bigdata.rdf.sail.webapp.QueryServlet.doGet(QueryServlet.java:274)
	at com.bigdata.rdf.sail.webapp.RESTServlet.doGet(RESTServlet.java:219)
	at com.bigdata.rdf.sail.webapp.MultiTenancyServlet.doGet(MultiTenancyServlet.java:214)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	at org.eclipse.jetty.server.Server.handle(Server.java:497)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:188)
	at com.bigdata.rdf.sail.webapp.QueryServlet$SparqlQueryTask.call(QueryServlet.java:830)
	at com.bigdata.rdf.sail.webapp.QueryServlet$SparqlQueryTask.call(QueryServlet.java:649)
	at com.bigdata.rdf.task.ApiTaskForIndexManager.call(ApiTaskForIndexManager.java:68)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	... 1 more
Caused by: java.lang.NullPointerException
	at com.bigdata.rdf.sparql.ast.optimizers.TypeBasedASTJoinGroupPartitionReorderer.reorderNodes(TypeBasedASTJoinGroupPartitionReorderer.java:84)
	at com.bigdata.rdf.sparql.ast.optimizers.ASTJoinGroupOrderOptimizer.optimizeWithinPartition(ASTJoinGroupOrderOptimizer.java:441)
	at com.bigdata.rdf.sparql.ast.optimizers.ASTJoinGroupOrderOptimizer.optimizeWithinPartitions(ASTJoinGroupOrderOptimizer.java:319)
	at com.bigdata.rdf.sparql.ast.optimizers.ASTJoinGroupOrderOptimizer.optimizeJoinGroup(ASTJoinGroupOrderOptimizer.java:142)
	at com.bigdata.rdf.sparql.ast.optimizers.AbstractJoinGroupOptimizer.optimize(AbstractJoinGroupOptimizer.java:161)
	at com.bigdata.rdf.sparql.ast.optimizers.AbstractJoinGroupOptimizer.optimize(AbstractJoinGroupOptimizer.java:101)
	at com.bigdata.rdf.sparql.ast.optimizers.ASTOptimizerList.optimize(ASTOptimizerList.java:117)
	at com.bigdata.rdf.sparql.ast.eval.AST2BOpUtility.convert(AST2BOpUtility.java:261)
	at com.bigdata.rdf.sparql.ast.eval.ASTEvalHelper.evaluateTupleQuery(ASTEvalHelper.java:235)
	at com.bigdata.rdf.sail.BigdataSailTupleQuery.evaluate(BigdataSailTupleQuery.java:93)
	at com.bigdata.rdf.sail.BigdataSailTupleQuery.evaluate(BigdataSailTupleQuery.java:75)
	at org.openrdf.repository.sail.SailTupleQuery.evaluate(SailTupleQuery.java:75)
	at com.bigdata.rdf.sail.webapp.BigdataRDFContext$TupleQueryTask.doQuery(BigdataRDFContext.java:1705)
	at com.bigdata.rdf.sail.webapp.BigdataRDFContext$AbstractQueryTask.innerCall(BigdataRDFContext.java:1562)
	at com.bigdata.rdf.sail.webapp.BigdataRDFContext$AbstractQueryTask.call(BigdataRDFContext.java:1527)
	at com.bigdata.rdf.sail.webapp.BigdataRDFContext$AbstractQueryTask.call(BigdataRDFContext.java:699)
	... 4 more

Event Timeline

Smalyshev raised the priority of this task from to Needs Triage.
Smalyshev updated the task description. (Show Details)
Smalyshev subscribed.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Smalyshev set Security to None.

This one also fails:

prefix wikibase: <http://wikiba.se/ontology#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix wd: <http://www.wikidata.org/entity/>
prefix wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?wiki ?wikiLabel ?lcount WHERE {
{
SELECT ?wiki (count(?l) as ?lcount) WHERE {
  ?wiki wdt:P31 wd:Q10876391 .
  ?wiki rdfs:label ?l .
} GROUP BY ?wiki
ORDER BY DESC(?lcount)
}
  hint:Query hint:optimizer "None" .
  SERVICE wikibase:language {
    bd:param wikibase:language "en" .
    ?wiki rdfs:label ?wikiLabel .
  }
}
Deskana triaged this task as Medium priority.
Deskana subscribed.

This is still in progress. It was deprioritised for a while since it's not super urgent, but @Smalyshev plans to look at it within a day or two.

OK, turns out it's not really a bug. The correct service name is wikibase:label, not wikibase:language, but Blazegraph is not good in reporting incorrect service - it just produces NPE instead. Which is probably something that needs to be fixed in Blazegraph.
See: https://jira.blazegraph.com/browse/BLZG-1571

Change 272820 had a related patch set uploaded (by Smalyshev):
Fix NPE on unknown service

https://gerrit.wikimedia.org/r/272820

Change 272820 merged by jenkins-bot:
Fix NPE on unknown service

https://gerrit.wikimedia.org/r/272820