rvesse commented on issue #1634:
URL: https://github.com/apache/jena/issues/1634#issuecomment-1326519765

   > By the way, what's the difference in sorting with and without projecting 
the sorted variable? With selection of `?l` it doesn't fail
   
   So the SPARQL specification [section 
18.2.5](https://www.w3.org/TR/sparql11-query/#convertSolMod) says that `ORDER 
BY` is applied prior to `DISTINCT`
   
   **BUT** ARQ includes an optimiser that swaps the ordering i.e. applies 
`DISTINCT` first in cases where all the variables in the `ORDER BY` are also 
projected.  This is semantically equivalent and is shown to substantially 
increase performance because you throw out all the non-distinct solutions prior 
to ordering.  So in that case every row is guaranteed to be unique and you 
can't ever get any unstable sorting results as every row is different (at least 
for your dataset).
   
   I suspect what happens in the failing case is that you have two solutions 
with the custom datatype literals present and we aren't guaranteeing to provide 
a stable sort (see PR #1406 that Andy referenced) over those.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to