fluree / core

Fluree releases and public bug reports
0 stars 0 forks source link

`@list` Order Preservation is Broken on `server` / Nexus #75

Closed Jackamus29 closed 4 months ago

Jackamus29 commented 5 months ago

Describe the bug When inserting a list of values using the @container type of @list, I expect to get back the same order of values in query results.

To Reproduce

  1. Create ledger

    {
    "ledger": "list-order-test",
    "@context": {
    "ex": "http://example.org/ns/",
    "ex:age": {
      "@container": "@list"
    }
    },
    "insert": [
    {
      "@id": "zeti",
      "ex:age": [97, 19, 97, 19, 97]
    }
    ]
    }
  2. Query

    {
    "from": "list-order-test",
    "@context": {
    "ex": "http://example.org/ns/",
    "ex:age": {
      "@container": "@list"
    }
    },
    "selectDistinct": { "?s": ["*"] },
    "where": {
    "@id": "?s",
    "ex:age": "?age"
    }
    }

Expected result

[
  {
    "@id": "zeti",
    "ex:age": [
      97,
      19,
      97,
      19,
      97
    ]
  }
]

Actual result

[
  {
    "@id": "zeti",
    "ex:age": [
      19,
      19,
      97,
      97,
      97
    ]
  }
]
aaj3f commented 5 months ago

@Jackamus29 & I confirmed that even the exact test in db (https://github.com/fluree/db/blob/1507c85ab3490c4419a65e236183317a2b43196b/test/fluree/db/query/json_ld_basic_test.clj#L131-L149) when issued via server does not preserve order in query results.

aaj3f commented 5 months ago

Related to fluree/core#74

Jackamus29 commented 4 months ago

Confirmed fix from https://github.com/fluree/db/pull/720 Thanks @dpetran!