Stream: cql
Topic: sorting of lists
Georg Fette (Feb 13 2019 at 12:02):
Hello, When I sort a list of complex objects using a "sort by" path indicating the path to a member with which to sort by, the final order of the list can be ambiguous if there are multiple objects with the same primitive indicated by the given path. How should such an ambiguity be handled in an implementation ?
Bryn Rhodes (Feb 15 2019 at 23:06):
Hi @Georg Fette, I'm not sure I follow the issue. Since the path will be evaluated for each object in the result, there wouldn't be any ambiguity with respect to a single object, right? I must be missing something, can you provide an example of what you mean?
Georg Fette (Feb 18 2019 at 07:54):
HI @Bryn Rhodes , I mean something like
[Encounter] A return Tuple { e: A, eoc: Last(A.episodeOfCare B sort by period.start) }
When there are multiple episodes of care that have the same start, which episode should be returned ?
Bryn Rhodes (Feb 18 2019 at 17:46):
Ah, I see. When the possibility of duplicates exist, the resulting order is unspecified. Looking through the spec, I see that is never stated explicitly, so I've added an STU comment (#1751) to that effect.
Last updated: Apr 12 2022 at 19:14 UTC