subql icon indicating copy to clipboard operation
subql copied to clipboard

add support for null ordering in 'order by' query (#2387)

Open abhishek818 opened this issue 1 year ago • 6 comments

Description

adds support for null ordering in 'order by' query

Fixes #2387

Type of change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [X] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

Checklist

  • [ ] I have tested locally
  • [X] I have performed a self review of my changes
  • [ ] Updated any relevant documentation
  • [X] Linked to any relevant issues
  • [x] I have added tests relevant to my changes
  • [ ] Any dependent changes have been merged and published in downstream modules
  • [X] My code is up to date with the base branch
  • [x] I have updated relevant changelogs. We suggest using chan

abhishek818 avatar Aug 09 '24 12:08 abhishek818

@stwiname @jiqiang90 hey are the test suites broken (some pass, others fail) ? Was trying to add a test case in packages\query\src\graphql\graphql.test.ts file. Can you help with running the tests (any specific set of commands etc.)

abhishek818 avatar Aug 09 '24 12:08 abhishek818

anyways up for a review..

abhishek818 avatar Aug 09 '24 13:08 abhishek818

@stwiname @jiqiang90 hey are the test suites broken (some pass, others fail) ? Was trying to add a test case in packages\query\src\graphql\graphql.test.ts file. Can you help with running the tests (any specific set of commands etc.)

@abhishek818 because its an integration test it needs a DB to connect to. You can either run postgres yourself or yarn test:docker but you would probably want to change it to just run that test.

These changes look good but tests are still needed,

stwiname avatar Aug 11 '24 22:08 stwiname

Added the tests, Up for review..

test-1 | PASS packages/query/src/graphql/graphql.test.ts (863 MB heap size)

abhishek818 avatar Aug 12 '24 16:08 abhishek818

There is a failing test GraphqlHistorical › to filter historical items when ordering, this is a change in behaviour as if the nulls order is not specified then it should be default.

As the Postgres docs say ASC and DESC change the default null behaviour. This should be retained if null order isn't specified.

Thanks for pointing this out. Have fixed this. Up for a review now..

abhishek818 avatar Aug 15 '24 08:08 abhishek818

I am force pushing the commits everytime to keep it as 1 commit (was not sure due to changelog file changes), let me know if its alright or I can push changes in separate commits.

abhishek818 avatar Aug 15 '24 08:08 abhishek818