Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of columns in AQL resultset are in arbitrary order #37

Closed
nr23730 opened this issue Nov 13, 2019 · 4 comments
Closed

Order of columns in AQL resultset are in arbitrary order #37

nr23730 opened this issue Nov 13, 2019 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@nr23730
Copy link
Contributor

nr23730 commented Nov 13, 2019

When I execute AQL queries the columns of the resultset are in an arbitrary order. I would expect them in the order given in the query, as also shown here: https://specifications.openehr.org/releases/ITS-REST/latest/query.html#query-execute-query-post

Example:

{
  "q": "SELECT tnm/data[at0001]/events[at0002]/data[at0003]/items[at0008]/value/value as T, tnm/data[at0001]/events[at0002]/data[at0003]/items[at0009]/value/value as N, tnm/data[at0001]/events[at0002]/data[at0003]/items[at0010]/value/value as M FROM EHR e[ehr_id/value='4b688173-0388-4cf2-9062-694b86b7fbe3'] CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.tnm_stage_clinical.v0] CONTAINS OBSERVATION tnm[openEHR-EHR-OBSERVATION.tnm_stage_clinical.v0]"
}

Result:

  <columns>
    <columns>
      <path>/data[at0001]/events[at0002]/data[at0003]/items[at0008]/value/value</path>
      <name>T</name>
    </columns>
    <columns>
      <path>/data[at0001]/events[at0002]/data[at0003]/items[at0010]/value/value</path>
      <name>M</name>
    </columns>
    <columns>
      <path>/data[at0001]/events[at0002]/data[at0003]/items[at0009]/value/value</path>
      <name>N</name>
    </columns>
  </columns>

Is this intended or an issue?

Thanks in advance!

@birgerhaarbrandt
Copy link
Contributor

Thanks for raising this issue. This should not be intended behavior from my perspective. We will fix this soonly.

@birgerhaarbrandt birgerhaarbrandt added the bug Something isn't working label Nov 24, 2019
@chevalleyc
Copy link
Contributor

Resultset in XML is basically non standard and there is no provision to support it; that is only JSON result formatting is currently specified. Further, using JSON, since results are referenced in a hash table, order is not relevant and should be resolved at client level.

@nr23730 nr23730 changed the title Order of columns in AQL resultset are in alphabetic order Order of columns in AQL resultset are in arbitrary order Dec 4, 2019
@stefanspiska
Copy link
Contributor

@chevalleyc I agree that the order should be handelt on client level. Hover it make it nicer when a human is working with the endpoint. Since the performance of HashMap and LinkedHashMap are similar I would like to see #69 approved.

@chevalleyc
Copy link
Contributor

The changes have been merged with PR #69 . Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants