History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: SES-970
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jeen Broekstra
Reporter: Jeen Broekstra
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Sesame

ClassCastException on queries with sameTerm on NativeStore

Created: 28/Mar/12 10:54 PM   Updated: 23/May/12 12:54 AM
Component/s: Native Sail, Query Engine, Query Optimizer
Affects Version/s: 2.6.4
Fix Version/s: 2.6.5

Issue Links:
Followup
 
This issue is followed up by:
SES-998 ClassCastException on queries with sa... Major Resolved


 Description   
Example query:

select * where { ?s ?p ?o, ?x filter (sameTerm("literal", ?s)) }

causes a ClassCastException when evaluated on a native store. See stacktrace below.

Apparent cause of the bug is that the SameTermFilterOptimizer inlines the variable ?s with the literal value "literal". The native store's cardinality calculator tries to determine the cardinality of the statement pattern (?s, ?p, ?o) and attempts to cast the value of ?s to a resource (which it isn't, because we have just inlined it to a literal).

Two possible fixes. Either adapt SameTermFilterOptimizer to not inline literals in statementpattern-positions they can't legally occur, or alternatively adapt NativeStoreCardinalityCalculator to catch ClassCastExceptions and revert to a default cardinality estimate.

Stacktrace (as provided by Allesandro Bollini on the mailinglist):


java.lang.ClassCastException: org.openrdf.model.impl.LiteralImpl cannot be cast to org.openrdf.model.Resource
at org.openrdf.sail.nativerdf.NativeEvaluationStatistics$NativeCardinalityCalculator.getCardinality(NativeEvaluationStatistics.java:43)
at org.openrdf.query.algebra.evaluation.impl.EvaluationStatistics$CardinalityCalculator.meet(EvaluationStatistics.java:114)
at org.openrdf.query.algebra.StatementPattern.visit(StatementPattern.java:212)
at org.openrdf.query.algebra.evaluation.impl.EvaluationStatistics.getCardinality(EvaluationStatistics.java:43)
at org.openrdf.query.algebra.evaluation.impl.QueryJoinOptimizer$JoinVisitor.meet(QueryJoinOptimizer.java:89)
at org.openrdf.query.algebra.Join.visit(Join.java:51)
(snip)


 All   Comments   Change History      Sort Order:
There are no comments yet on this issue.