Weird query behaviour with GROUP BY clause

Executing this query towards Stardog 7.0.0 with any data:

SELECT * 
FROM <urn:test:whatever> {
  {SELECT ?s ?o
   WHERE {
      OPTIONAL {
         ?s ?p ?o .
       }
  } GROUP BY ?s ?o}
  FILTER (?o in (<urn:test:whatever:IJustMadeThisUp>))
}

Returns this result set:

| s | o |
|   | urn:test:whatever:IJustMadeThisUp | 

Thanks for the report, we acknowledge that this is a bug related to optimization of filters with IN. A short-term workaround would be to disable it with a query hint:

SELECT * 
FROM <urn:test:whatever> {

#pragma optimizer.filters.in off

  {SELECT ?s ?o
   WHERE {
      OPTIONAL {
         ?s ?p ?o .
       }
  } GROUP BY ?s ?o}
  FILTER (?o in (<urn:test:whatever:IJustMadeThisUp>))
}

The bug occurs when filtering is done on a variable which may not be bound to a value. We will fix this no later than in the Nov release.

Thanks,
Pavel