subquery / subql

SubQuery is an Open, Flexible, Fast and Universal data indexing framework for web3. Our mission is to help developers create the decentralised products of the future.
https://subquery.network
GNU General Public License v3.0
18.94k stars 331 forks source link

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

Closed abhishek818 closed 2 months ago

abhishek818 commented 3 months ago

Description

adds support for null ordering in 'order by' query

Fixes #2387

Type of change

Checklist

abhishek818 commented 3 months ago

@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 commented 3 months ago

anyways up for a review..

stwiname commented 2 months ago

@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,

abhishek818 commented 2 months ago

Added the tests, Up for review..

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

abhishek818 commented 2 months ago

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 commented 2 months ago

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.