Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1778

COUNT(DISTINCT *) can generate incorrect results.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Jena 3.13.1
    • Jena 3.14.0
    • ARQ
    • None

    Description

      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.

      SELECT (COUNT(DISTINCT *) as ?c)
      WHERE { <child3> <p>+/<label> ?lbl }
      
      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

       

      Attachments

        Issue Links

          Activity

            People

              andy Andy Seaborne
              sfell Simon Fell
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m