cube icon indicating copy to clipboard operation
cube copied to clipboard

fix(api-gateway) fix(schema-compiler): fixes an issue where queries t…

Open rdwoodring opened this issue 1 year ago • 8 comments

fix(api-gateway) fix(schema-compiler): fixes an issue where queries to get the total count of results were incorrectly applying sorting from the original query and also were getting default ordering applied when the query ordering was stripped out

Check List

  • [ ] Tests has been run in packages where changes made if available
  • [x] Linter has been run for changed code
  • [ ] Tests for the changes have been added if not covered yet
  • [ ] Docs have been added / updated if required

Issue Reference this PR resolves

#7446

Description of Changes Made (if issue reference is not provided)

  • updates api gateway to remove order field from queries that are getting a count of total results matching
  • updates the base query's logic for defaulting order so that it does an early return and does not default order if the query is getting the total (follows the same path as the logic doing an early return for preaggreation queries)

rdwoodring avatar Apr 01 '24 17:04 rdwoodring

The latest updates on your projects. Learn more about Vercel for Git ↗︎

8 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-angular-dashboard ⬜️ Ignored (Inspect) Visit Preview Apr 1, 2024 5:17pm
examples-react-d3 ⬜️ Ignored (Inspect) Visit Preview Apr 1, 2024 5:17pm
examples-react-dashboard ⬜️ Ignored (Inspect) Visit Preview Apr 1, 2024 5:17pm
examples-react-data-table ⬜️ Ignored (Inspect) Visit Preview Apr 1, 2024 5:17pm
examples-react-highcharts ⬜️ Ignored (Inspect) Visit Preview Apr 1, 2024 5:17pm
examples-react-material-ui ⬜️ Ignored (Inspect) Visit Preview Apr 1, 2024 5:17pm
examples-react-pivot-table ⬜️ Ignored (Inspect) Visit Preview Apr 1, 2024 5:17pm
examples-vue-query-builder ⬜️ Ignored (Inspect) Visit Preview Apr 1, 2024 5:17pm

vercel[bot] avatar Apr 01 '24 17:04 vercel[bot]

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 47.92%. Comparing base (2ca99de) to head (cb7ecb9). Report is 524 commits behind head on master.

Files with missing lines Patch % Lines
packages/cubejs-api-gateway/src/gateway.ts 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8060      +/-   ##
==========================================
+ Coverage   47.90%   47.92%   +0.02%     
==========================================
  Files         154      154              
  Lines       21034    21035       +1     
  Branches     5422     5422              
==========================================
+ Hits        10077    10082       +5     
+ Misses      10203    10199       -4     
  Partials      754      754              
Flag Coverage Δ
cube-backend 47.92% <50.00%> (+0.02%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 01 '24 17:04 codecov[bot]

Thanks for your contribution, @rdwoodring! I've assigned this to @paveltiunov so he can do a review.

igorlukanin avatar Apr 02 '24 13:04 igorlukanin

@paveltiunov any idea when you'll get a chance to review this or get it pulled in? I've been running on a fork in production and would ideally like to see this pulled so I can get back onto the official images

rdwoodring avatar Apr 25 '24 14:04 rdwoodring

@rdwoodring Thanks for contributing! We'd need E2E tests for that. You can put it in the Postgres smoke test.

paveltiunov avatar Apr 27 '24 20:04 paveltiunov

Any specific tests you'd like to see, @paveltiunov ? Just that queries with totalQuery return results without an error? Or can I actually test what query is being generated against the database to see that it does not have an order by?

Thanks

rdwoodring avatar Apr 27 '24 21:04 rdwoodring

@rdwoodring The later. We need a test to see it doesn't have an order by and executes in db.

paveltiunov avatar Jun 22 '24 06:06 paveltiunov

Could we please get this PR reviewed ? I am facing issues in one of the project due to this and I had to execute multiple same queries just to get total number of records.

niravjprabtani avatar Aug 12 '24 10:08 niravjprabtani