Skip to content

Commit

Permalink
test cases for pipelined hash join bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mschmidt00 authored and beebs-systap committed Mar 14, 2019
1 parent 7fc6b4c commit 3434b68
Show file tree
Hide file tree
Showing 22 changed files with 1,558 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,32 @@ public boolean addDistinct(final IBindingSet solution) {

}

/**
* @param bs the binding set to check
* @return if the bucket contains the binding set, false otherwise
*/
public boolean contains(final IBindingSet bs) {

if (solutions.isEmpty()) {
return false;
}

final Iterator<SolutionHit> itr = solutions.iterator();

while (itr.hasNext()) {

final SolutionHit aSolution = itr.next();

if (aSolution.solution.equals(bs)) {
return true;
}

}

return false; // not found

}

@Override
final public Iterator<SolutionHit> iterator() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ public static Test suite()
// an early exception when accessing named graphs in triples mode
suite.addTest(TestTicket1105.suite());

if (QueryHints.DEFAULT_REIFICATION_DONE_RIGHT) {
suite.addTestSuite(TestBrokenDatetimeParsing.class);

if (QueryHints.DEFAULT_REIFICATION_DONE_RIGHT) {

/*
* Test suite for the SPARQL extension for "reification done right".
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.bigdata.rdf.sparql.ast.eval;


/**
* Test case fot date time parsing in queries when specifying dates containing a numerical time zone spec.
* We suspected a bug, but there actually was only a problem in missing URL encoding for the '+' sign when
* executing the query with curl. Checking in the test case nevertheless to increase confidence.
*
* See https://github.com/blazegraph/database/issues/107
*
* @author schmdtm
*/
public class TestBrokenDatetimeParsing extends AbstractDataDrivenSPARQLTestCase {

public TestBrokenDatetimeParsing() {
}

/**
* Data:
* <http://s1a> <http://date> "2012-01-28T00:00:00.000Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
* <http://s1b> <http://date> "2012-01-28T00:00:00.000+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
* <http://s2a> <http://date> "2012-01-30T00:00:00.000Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
* <http://s2b> <http://date> "2012-01-30T00:00:00.000+00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
*
* Query:
* PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
* SELECT * WHERE {
* ?s <http://date> ?o
* FILTER(?o > "2012-01-29T00:00:00.000+00:00"^^xsd:dateTime)
* }
*
* => expected to select s2a and s2b (which point to the same timestamp)
*/
public void test_datetime_roundtripping_with_numerical_time_zone() throws Exception {

new TestHelper(
"datetime-roundtripping01",// testURI,
"datetime-roundtripping01.rq",// queryFileURL
"datetime-roundtripping.ttl",// dataFileURL
"datetime-roundtripping.srx"// resultFileURL
).runTest();
}

/**
* Variant of the test case with query containing the date specified in Zulu format, using 'Z'.
* Note that this version used to work all the time, just added to avoid regressions.
*/
public void test_datetime_roundtripping_with_zulu_time_zone() throws Exception {

new TestHelper(
"datetime-roundtripping02",// testURI,
"datetime-roundtripping02.rq",// queryFileURL
"datetime-roundtripping.ttl",// dataFileURL
"datetime-roundtripping.srx"// resultFileURL
).runTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,267 @@ public void testPipelinedHashJoinNotExistsMultiplicityAnalyticMode() throws Exce

assertPipelinedPlanOrNot(queryPlan, astContainer, true, true);

}

}

/**
* Bug reporting MINUS pipelined hash join being broken, test case for analytic mode.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinMinusBug01aAnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-minusbug01a-analytic",// testURI
"pipelined-hashjoin-minusbug01ab-analytic.rq", // queryURI
"pipelined-hashjoin-minusbug01a.nt", // dataUiI
"pipelined-hashjoin-minusbug01a.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, true, true);
}

/**
* Bug reporting MINUS pipelined hash join being broken, test case for non-analytic mode.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinMinusBug01aNonAnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-minusbug01a-nonanalytic",// testURI
"pipelined-hashjoin-minusbug01ab-nonanalytic.rq", // queryURI
"pipelined-hashjoin-minusbug01a.nt", // dataURI
"pipelined-hashjoin-minusbug01a.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, true, false);
}

/**
* Bug reporting MINUS pipelined hash join being broken, just making sure that the non-pipelined version
* for the test case (i.e., query without LIMIT) is working as expected in analytic mode.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinDisabledMinusBug01aAnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-disabled-minusbug01ab-analytic",// testURI
"pipelined-hashjoin-disabled-minusbug01ab-analytic.rq", // queryURI
"pipelined-hashjoin-minusbug01a.nt", // dataURI
"pipelined-hashjoin-minusbug01a.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, false, true);
}

/**
* Bug reporting MINUS pipelined hash join being broken, just making sure that the non-pipelined version
* for the test case (i.e., query without LIMIT) is working as expected in non-analytic mode.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinDisabledMinusBug01aNonAnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-disabled-minusbug01a-nonanalytic",// testURI
"pipelined-hashjoin-disabled-minusbug01ab-nonanalytic.rq", // queryURI
"pipelined-hashjoin-minusbug01a.nt", // dataURI
"pipelined-hashjoin-minusbug01a.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, false, false);

}


/**
* Bug reporting MINUS pipelined hash join being broken, test case for analytic mode.
* Variant of 01a that is a little more challenging, as it contains more solutions and duplicates.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinMinusBug01bAnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-minusbug01b-analytic",// testURI
"pipelined-hashjoin-minusbug01ab-analytic.rq", // queryURI
"pipelined-hashjoin-minusbug01b.nt", // dataUiI
"pipelined-hashjoin-minusbug01b.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, true, true);
}

/**
* Bug reporting MINUS pipelined hash join being broken, test case for non-analytic mode.
* Variant of 01a that is a little more challenging, as it contains more solutions and duplicates.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinMinusBug01bNonAnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-minusbug01b-nonanalytic",// testURI
"pipelined-hashjoin-minusbug01ab-nonanalytic.rq", // queryURI
"pipelined-hashjoin-minusbug01b.nt", // dataURI
"pipelined-hashjoin-minusbug01b.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, true, false);
}

/**
* Bug reporting MINUS pipelined hash join being broken, just making sure that the non-pipelined version
* for the test case (i.e., query without LIMIT) is working as expected in analytic mode.
*
* Variant of 01a that is a little more challenging, as it contains more solutions and duplicates.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinDisabledMinusBug01bAnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-disabled-minusbug01b-analytic",// testURI
"pipelined-hashjoin-disabled-minusbug01ab-analytic.rq", // queryURI
"pipelined-hashjoin-minusbug01b.nt", // dataURI
"pipelined-hashjoin-minusbug01b.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, false, true);
}

/**
* Bug reporting MINUS pipelined hash join being broken, just making sure that the non-pipelined version
* for the test case (i.e., query without LIMIT) is working as expected in non-analytic mode.
*
* Variant of 01a that is a little more challenging, as it contains more solutions and duplicates.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinDisabledMinusBug01bNonAnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-disabled-minusbug01b-nonanalytic",// testURI
"pipelined-hashjoin-disabled-minusbug01ab-nonanalytic.rq", // queryURI
"pipelined-hashjoin-minusbug01b.nt", // dataURI
"pipelined-hashjoin-minusbug01b.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, false, false);

}

/**
* Bug reporting MINUS pipelined hash join being broken, test case for analytic mode.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinMinusBug02AnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-minusbug02-analytic",// testURI
"pipelined-hashjoin-minusbug02-analytic.rq", // queryURI
"pipelined-hashjoin-minusbug02.nt", // dataUiI
"pipelined-hashjoin-minusbug02.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, true, true);
}

/**
* Bug reporting MINUS pipelined hash join being broken, test case for non-analytic mode.
*
* Variant of the 01* test cases, where we have a join inducing duplicates across chunks. This aims at
* testing code paths that skip subquery re-evaluation for binding sets that have been evaluated in
* previous passes.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinMinusBug02NonAnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-minusbug02-nonanalytic",// testURI
"pipelined-hashjoin-minusbug02-nonanalytic.rq", // queryURI
"pipelined-hashjoin-minusbug02.nt", // dataURI
"pipelined-hashjoin-minusbug02.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, true, false);
}

/**
* Bug reporting MINUS pipelined hash join being broken, just making sure that the non-pipelined version
* for the test case (i.e., query without LIMIT) is working as expected in analytic mode.
*
* Variant of the 01* test cases, where we have a join inducing duplicates across chunks. This aims at
* testing code paths that skip subquery re-evaluation for binding sets that have been evaluated in
* previous passes.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinDisabledMinusBug02AnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-disabled-minusbug02-analytic",// testURI
"pipelined-hashjoin-disabled-minusbug02-analytic.rq", // queryURI
"pipelined-hashjoin-minusbug02.nt", // dataURI
"pipelined-hashjoin-minusbug02.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, false, true);
}

/**
* Bug reporting MINUS pipelined hash join being broken, just making sure that the non-pipelined version
* for the test case (i.e., query without LIMIT) is working as expected in non-analytic mode.
*
* Variant of the 01* test cases, where we have a join inducing duplicates across chunks. This aims at
* testing code paths that skip subquery re-evaluation for binding sets that have been evaluated in
* previous passes.
*
* See https://github.com/blazegraph/database/issues/107
*/
public void testPipelinedHashJoinDisabledMinusBug02NonAnalyticMode() throws Exception {

final ASTContainer astContainer = new TestHelper(
"pipelined-hashjoin-disabled-minusbug02-nonanalytic",// testURI
"pipelined-hashjoin-disabled-minusbug02-nonanalytic.rq", // queryURI
"pipelined-hashjoin-minusbug02.nt", // dataURI
"pipelined-hashjoin-minusbug02.srx" // resultURI
).runTest();

final PipelineOp queryPlan = astContainer.getQueryPlan();

assertPipelinedPlanOrNot(queryPlan, astContainer, false, false);

}




/**
* Asserts that a PipelinedHashIndexAndSolutionSetOp is contained in the
* query plan if contains equals <code>true</code>, otherwise that it is
Expand Down
Loading

0 comments on commit 3434b68

Please sign in to comment.