You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jena.apache.org by "ting668 (via GitHub)" <gi...@apache.org> on 2026/09/20 02:14:34 UTC

[I] `GROUP_CONCAT(DISTINCT ...)` over an empty group returns an unbound value instead of the empty string [jena]

ting668 opened a new issue, #4240:
URL: https://github.com/apache/jena/issues/4240

   ### Version
   
   6.2.0
   
   ### What happened?
   
   **Reporter:** ting668
   
   ## Environment
   
   - Apache Jena Version: `6.2.0`
   - Java Version: `21.0.12+8-LTS`
   
   ## Description
   
   While testing Apache Jena using a method based on attribute-constraint analysis, I found that `GROUP_CONCAT(DISTINCT ...)` leaves its result variable unbound when the group is empty.
   
   The query has no explicit `GROUP BY`, so a query whose pattern matches no solutions still has one (empty) implicit group; `GROUP_CONCAT` over empty input should produce the empty string as the aggregate value. Instead, the single result row carries no value for the aggregate variable.
   
   ## How to Reproduce and Expected Behavior
   
   **Note:** The queries below are a **minimized, simplified example** reproducing the bug.
   
   Buggy query (no data needed):
   
   ```sparql
   SELECT (GROUP_CONCAT(DISTINCT ?v) AS ?answer) WHERE { ?s <urn:p> ?v . ?s <urn:q> ?tag . }
   ```
   
   The query is run against an empty default graph (no data loaded).
   
   Expected behavior: the query returns one row whose aggregate value is the empty string:
   
   ```text
   [{"answer":"\"\"^^xsd:string"}]
   ```
   
   Actual behavior: one row is returned, but `?answer` is unbound:
   
   ```text
   [{}]
   ```
   
   This suggests that the empty-group path of `GROUP_CONCAT` produces no value instead of the empty string, leaving the projected aggregate variable unbound.
   
   
   ### Relevant output and stacktrace
   
   ```shell
   
   ```
   
   ### Are you interested in making a pull request?
   
   None


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


Re: [I] `GROUP_CONCAT(DISTINCT ...)` over an empty group returns an unbound value instead of the empty string [jena]

Posted by "afs (via GitHub)" <gi...@apache.org>.
afs commented on issue #4240:
URL: https://github.com/apache/jena/issues/4240#issuecomment-5752139328

   Confirmed


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org