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

GraphQL: le,lt,ge, gt on datetime work opposite way (ie. le as ge) #2065

Open
picbeats opened this issue Dec 12, 2023 · 3 comments
Open

GraphQL: le,lt,ge, gt on datetime work opposite way (ie. le as ge) #2065

picbeats opened this issue Dec 12, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@picbeats
Copy link

picbeats commented Dec 12, 2023

Describe the bug
In GraphQL queries
le,lt,ge, gt on datetime work opposite way (ie. le as ge)

To Reproduce
Schema

[
  {
    "@type": "@context",
    "@documentation": {
      "@title": "",
      "@description": ""
    },
    "@schema": "terminusdb:///schema#",
    "@base": "terminusdb:///data/"
  },
  {
    "@type": "Class",
    "@id": "A",
    "@key": {
      "@type": "Lexical",
      "@fields": [
        "name"
      ]
    },
    "name": "xsd:string",
    "timestamp": {
      "@type": "Optional",
      "@class": "xsd:dateTime"
    }
  }
]

Data:

[
  {
    "@id": "A/a1",
    "@type": "A",
    "name": "a1",
    "timestamp": "2023-12-12T15:41:33.870064Z"
  },
  {
    "@id": "A/a2",
    "@type": "A",
    "name": "a2",
    "timestamp": "2023-12-12T16:41:33.870064Z"
  }
]

GraphQL query

query{
  A(filter:{timestamp:{ge:"2023-12-12T16:11:33.870064Z"}}) {
    timestamp
    name
  }
}

Result

{
  "data": {
    "A": [
      {
        "timestamp": "2023-12-12T15:41:33.870064Z",
        "name": "a1"
      }
    ]
  }
}

Expected behavior

Query should return record with name "a2" since it timestamp "2023-12-12T16:41:33.870064Z" is bigger that specified "2023-12-12T16:11:33.870064Z"

Similar issues with other comparison operators, looks like le, lt are swapped with ge,gt

Info (please complete the following information):

  • Docker image TerminusDB v11.1.9 on WSL/Ubuntu22.04

Additional context
Add any other context about the problem here.

@picbeats picbeats added the bug Something isn't working label Dec 12, 2023
@picbeats picbeats changed the title Graphql: le,lt,ge, gt on datetime work opposite way (ie. le as ge) GraphQL: le,lt,ge, gt on datetime work opposite way (ie. le as ge) Dec 12, 2023
@GavinMendelGleason
Copy link
Member

Fixed in #2058

@picbeats
Copy link
Author

picbeats commented Dec 13, 2023

It's not the same bug. I checked #2058 changes, and while it does fix le vs lt it does not seems to me that it fixes opposite ordering of datetime. I'd expect lt with gt swap in the code. There is also apparently no test checking correct ordering for dateTime.

@GavinMendelGleason
Copy link
Member

Aha!

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

2 participants