I have a question about SPARQL aggregates. Consider the following query:

```
SELECT ?x (MAX(?value) AS ?max)
WHERE {
?x ex:p ?value
} GROUP BY ?x
```

It's pretty simple: Find all `ex:p`

triples, group them by subject, and for each distinct subject, return the object with the maximum value.

But what happens if there are no matching subjects? Let's say, if we run this on an empty graph?

I would have expected that it would return zero solutions.

However what Jena does is this:

```
-----------
| x | max |
===========
| | |
-----------
```

That result seems rather strange to me. It's not what I would have expected. Where does this extra empty result come from?

Now I don't think that Jena gets this wrong; it's probably that my expectations are off. Can someone explain to me why this is the correct result?

**Edit:** An example that may make even clearer why this behaviour seems odd to me:

```
SELECT ?x (SAMPLE(?value) AS ?some_value)
WHERE {
?x ex:p ?value
} GROUP BY ?x
```

If there's no `ex:p`

triples, then there are no values, so there's nothing to sample from. But again, the result is a row with variables `?x`

and `?some_value`

, and both unbound.