From: <tho...@us...> - 2014-03-26 17:35:06
|
Revision: 8020 http://sourceforge.net/p/bigdata/code/8020 Author: thompsonbry Date: 2014-03-26 17:35:00 +0000 (Wed, 26 Mar 2014) Log Message: ----------- Added test suite for #868 (COUNT DISTINCT does not return any solutions if there are no solutions in the data that flow into that operator) Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestAggregationQuery.java Added Paths: ----------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_distinct_emptyResult.rq branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_distinct_emptyResult.srx branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_distinct_emptyResult.trig branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_emptyResult.rq branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_emptyResult.srx branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_emptyResult.trig Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestAggregationQuery.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestAggregationQuery.java 2014-03-26 17:26:14 UTC (rev 8019) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/TestAggregationQuery.java 2014-03-26 17:35:00 UTC (rev 8020) @@ -138,5 +138,49 @@ ).runTest(); } + + /** + * Query correctly returns one row having a value of ZERO (0) for the count + * since there are no solutions in the data that match the query. + * + * <pre> + * select (count(?s) as ?count) { + * ?s ?p "abcedefg" . + * } + * </pre> + * + * @see <a href="http://trac.bigdata.com/ticket/868"> COUNT(DISTINCT) + * returns no rows rather than ZERO. </a> + */ + public void test_count_emptyResult() throws Exception { + + new TestHelper("count_emptyResult", // testURI, + "count_emptyResult.rq",// queryFileURL + "count_emptyResult.trig",// dataFileURL + "count_emptyResult.srx"// resultFileURL + ).runTest(); + } + /** + * Variation of the query above using COUNT(DISTINCT) should also return one + * solution having a binding of ZERO (0) for the count. + * + * <pre> + * select (count(distinct ?snippet) as ?count) { + * ?snippet ?p "abcedefg" . + * } + * </pre> + * + * @see <a href="http://trac.bigdata.com/ticket/868"> COUNT(DISTINCT) + * returns no rows rather than ZERO. </a> + */ + public void test_count_distinct_emptyResult()throws Exception { + + new TestHelper("count_distinct_emptyResult", // testURI, + "count_distinct_emptyResult.rq",// queryFileURL + "count_distinct_emptyResult.trig",// dataFileURL + "count_distinct_emptyResult.srx"// resultFileURL + ).runTest(); + } + } Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_distinct_emptyResult.rq =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_distinct_emptyResult.rq (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_distinct_emptyResult.rq 2014-03-26 17:35:00 UTC (rev 8020) @@ -0,0 +1,3 @@ +select (count(distinct ?s) as ?count) { + ?s ?p "abcedefg" . +} Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_distinct_emptyResult.srx =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_distinct_emptyResult.srx (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_distinct_emptyResult.srx 2014-03-26 17:35:00 UTC (rev 8020) @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<sparql + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:xs="http://www.w3.org/2001/XMLSchema#" + xmlns="http://www.w3.org/2005/sparql-results#" > + <head> + <variable name="count"/> + </head> + <results> + <result> + <binding name="count"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">0</literal> + </binding> + </result> + </results> +</sparql> Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_distinct_emptyResult.trig =================================================================== Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_emptyResult.rq =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_emptyResult.rq (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_emptyResult.rq 2014-03-26 17:35:00 UTC (rev 8020) @@ -0,0 +1,3 @@ +select (count(?s) as ?count) { + ?s ?p "abcedefg" . +} Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_emptyResult.srx =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_emptyResult.srx (rev 0) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_emptyResult.srx 2014-03-26 17:35:00 UTC (rev 8020) @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<sparql + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:xs="http://www.w3.org/2001/XMLSchema#" + xmlns="http://www.w3.org/2005/sparql-results#" > + <head> + <variable name="count"/> + </head> + <results> + <result> + <binding name="count"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">0</literal> + </binding> + </result> + </results> +</sparql> Added: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/sparql/ast/eval/count_emptyResult.trig =================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |