rdf4j icon indicating copy to clipboard operation
rdf4j copied to clipboard

Several testsuite tests flagging lots of assertions in algebra.Var.setParentNode(Var.java:112)

Open nguyenm100 opened this issue 2 years ago • 2 comments

Current Behavior

SPARQLQueryTest, SPARQLUpdateTest, ComplexSPARQLQueryText, W3CApprovedSPARQL11QueryTest

~15 tests are failing as a result of some variant of this.

Some stacks:

java.lang.AssertionError at org.eclipse.rdf4j.query.algebra.Var.setParentNode(Var.java:112) at org.eclipse.rdf4j.query.algebra.BinaryValueOperator.setLeftArg(BinaryValueOperator.java:70) at org.eclipse.rdf4j.query.algebra.BinaryValueOperator.(BinaryValueOperator.java:46) at org.eclipse.rdf4j.query.algebra.SameTerm.(SameTerm.java:26) at org.eclipse.rdf4j.query.algebra.evaluation.impl.CompareOptimizer$CompareVisitor.meet(CompareOptimizer.java:59) at org.eclipse.rdf4j.query.algebra.Compare.visit(Compare.java:89) at org.eclipse.rdf4j.query.algebra.Filter.visitChildren(Filter.java:77)

java.lang.AssertionError at org.eclipse.rdf4j.query.algebra.Var.setParentNode(Var.java:112) at org.eclipse.rdf4j.query.algebra.FunctionCall.addArg(FunctionCall.java:92) at org.eclipse.rdf4j.query.algebra.FunctionCall.addArgs(FunctionCall.java:79) at org.eclipse.rdf4j.query.algebra.FunctionCall.(FunctionCall.java:48) at org.eclipse.rdf4j.query.algebra.evaluation.impl.RegexAsStringFunctionOptimizer$RegexAsStringFunctionVisitor.containsCandidate(RegexAsStringFunctionOptimizer.java:77) at org.eclipse.rdf4j.query.algebra.evaluation.impl.RegexAsStringFunctionOptimizer$RegexAsStringFunctionVisitor.meet(RegexAsStringFunctionOptimizer.java:68) at org.eclipse.rdf4j.query.algebra.Regex.visit(Regex.java:71) at org.eclipse.rdf4j.query.algebra.BinaryValueOperator.visitChildren(BinaryValueOperator.java:96) at org.eclipse.rdf4j.query.algebra.helpers.AbstractQueryModelVisitor.meetNode(AbstractQueryModelVisitor.java:576) at org.eclipse.rdf4j.query.algebra.helpers.AbstractQueryModelVisitor.meetBinaryValueOperator(AbstractQueryModelVisitor.java:545) at org.eclipse.rdf4j.query.algebra.helpers.AbstractQueryModelVisitor.meet(AbstractQueryModelVisitor.java:118) at org.eclipse.rdf4j.query.algebra.And.visit(And.java:35)

java.lang.AssertionError at org.eclipse.rdf4j.query.algebra.Var.setParentNode(Var.java:112) at org.eclipse.rdf4j.query.algebra.StatementPattern.(StatementPattern.java:101) at org.eclipse.rdf4j.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:1486) at org.eclipse.rdf4j.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:237) at org.eclipse.rdf4j.query.parser.sparql.ast.ASTPathElt.jjtAccept(ASTPathElt.java:32) at org.eclipse.rdf4j.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:1411) at org.eclipse.rdf4j.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:237) at org.eclipse.rdf4j.query.parser.sparql.ast.ASTPathSequence.jjtAccept(ASTPathSequence.java:30) at org.eclipse.rdf4j.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:1358) at org.eclipse.rdf4j.query.parser.sparql.TupleExprBuilder.visit(TupleExprBuilder.java:237) at org.eclipse.rdf4j.query.parser.sparql.ast.ASTPathAlternative.jjtAccept(ASTPathAlternative.java:28

Expected Behavior

No assert errors

Steps To Reproduce

Run testsuite on files: SPARQLQueryTest, SPARQLUpdateTest, ComplexSPARQLQueryText, W3CApprovedSPARQL11QueryTest

Version

4.1.2-SNAPSHOT

Are you interested in contributing a solution yourself?

No response

Anything else?

No response

nguyenm100 avatar Sep 09 '22 17:09 nguyenm100

I know @hmottestad has recently gone over quite a lot of the codebase to fix this (see GH-4189 and GH-4157). Are these problems still occurring or has this now been rectified?

abrokenjester avatar Sep 16 '22 22:09 abrokenjester

Test Results - com_msd_gin_halyard_strategy_in_halyard-strategy.txt

Still occuring on 4.1.3 (see attached -- had to rename from .html to .txt to upload to comment here)

nguyenm100 avatar Sep 17 '22 13:09 nguyenm100

@hmottestad any updates on these asserts?

nguyenm100 avatar Oct 10 '22 19:10 nguyenm100

Could you create a pull request to reproduce these issues as I'm having a hard time reproducing them myself.

hmottestad avatar Oct 11 '22 04:10 hmottestad

just to sync, but were you able to wire up the tests mentioned here and still not seeing an issue? if so, maybe a halyard issue.

nguyenm100 avatar Oct 12 '22 10:10 nguyenm100

This is what I did: https://github.com/eclipse/rdf4j/pull/4211

Was it one of those tests?

hmottestad avatar Oct 12 '22 13:10 hmottestad

I reran the tests w/o halyard stuff and no more asserts. However, one of the test is failing and incorrect (tested against graphdb and docker rdf4j 4.2.0. graphdb returns correct result, 4.2.0 does not. It appears to also be broken in 4.1.0; i did not go back further).

Test is sparql11-exists-06

input data:

@prefix : <http://example/> .

:a :p 1 ; :q 1, 2 .
:b :p 3.0 ; :q 4.0, 5.0 .

query:

PREFIX : <http://example/>
SELECT * WHERE {
	?a :p ?n
	FILTER NOT EXISTS {
		?a :q ?m .
		FILTER(?n = ?m)
	}
}


==========================================================================================
# Expected bindings:

a=http://example/b n="3.0"^^<http://www.w3.org/2001/XMLSchema#decimal> 
==========================================================================================
# Actual bindings:

a=http://example/a n="1"^^<http://www.w3.org/2001/XMLSchema#integer> 
a=http://example/b n="3.0"^^<http://www.w3.org/2001/XMLSchema#decimal> 
==========================================================================================
# Unexpected bindings: 

a=http://example/a n="1"^^<http://www.w3.org/2001/XMLSchema#integer> 
==========================================================================================

nguyenm100 avatar Oct 14 '22 18:10 nguyenm100

Query plan:

Projection (resultSizeActual=2)
╠══ProjectionElemList
║     ProjectionElem "a"
║     ProjectionElem "n"
╚══Filter (resultSizeActual=2)
   ├──Not
   │     Exists
   │        Filter (resultSizeActual=0)
   │        ╠══Compare (=)
   │        ║     Var (name=n)
   │        ║     Var (name=m)
   │        ╚══StatementPattern (resultSizeEstimate=8, resultSizeActual=4)
   │              Var (name=a)
   │              Var (name=_const_f65eef3a_uri, value=http://example/q, anonymous)
   │              Var (name=m)
   └──StatementPattern (resultSizeEstimate=4, resultSizeActual=2)
         Var (name=a)
         Var (name=_const_f65eef39_uri, value=http://example/p, anonymous)
         Var (name=n)

hmottestad avatar Oct 28 '22 12:10 hmottestad

It works if I change the query to:

PREFIX : <http://example/>
SELECT * WHERE {
	?a :p ?n
	FILTER NOT EXISTS {
		?a :q ?n .
	}
}

So I think it's a scoping issue when using filters inside and EXISTS clause.

hmottestad avatar Oct 28 '22 12:10 hmottestad

I'm closing this issue since the original issue was about the assert in the Var class. I've create a new issue for the EXISTS scoping issue. https://github.com/eclipse/rdf4j/issues/4256

hmottestad avatar Oct 30 '22 16:10 hmottestad