You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Simon Fell (Jira)" <ji...@apache.org> on 2019/11/05 23:39:00 UTC

[jira] [Created] (JENA-1778) COUNT(DISTINCT *) can generate incorrect results.

Simon Fell created JENA-1778:
--------------------------------

             Summary: COUNT(DISTINCT *) can generate incorrect results.
                 Key: JENA-1778
                 URL: https://issues.apache.org/jira/browse/JENA-1778
             Project: Apache Jena
          Issue Type: Bug
          Components: ARQ
    Affects Versions: Jena 3.13.1
            Reporter: Simon Fell


Using COUNT(DISTINCT *) appears to generate the wrong result, in that it appears to include system generated bindings as part of the solution when DISTINCTing them. (I think similar to the issue in JENA-211).

For example, I'd expect these 2 queries to return the same results, as ?lbl should be the only variable considered part of the solutions.
{code:java}
SELECT (COUNT(DISTINCT *) as ?c)
WHERE { <child3> <p>+/<label> ?lbl }{code}
{{}}

 {{}}
{code:java}

{code}
{{SELECT (COUNT(DISTINCT ?lbl) as ?c)}}
{{WHERE \{ <child3> <p>+/<label> ?lbl }}}

 

However these return different results. A full simple repro case is available at https://github.com/superfell/jena-count-distinct-star

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)