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

fix(cubesql): Allow CAST to be used with reaggregation #7072

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MazterQyou
Copy link
Member

Check List

  • Tests has been run in packages where changes made if available
  • 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

Description of Changes Made

This PR fixes two issues with queries generated by Holistics.

The first issue is inability to use CAST with reaggregation. This would lead to expressions like TO_CHAR(CAST ( "public_orders"."completedAt" AS timestamptz ), 'YYYY-MM-DD HH24:MI:SS.US') erroring out if GROUP BY isn't in the query. Such expressions are now issued by Holistics for timestamp-type columns. This is now fixed.

The second issue is minor and is about formatting with TO_CHAR. Previously .US would imply up to microseconds but if the precision wasn't high enough (for example, .000000), the decimal part could have been cut in length or be entirely missing. This was inconsistent with PostgreSQL and is now resolved; .US will always convert to six decimal digits.

Related tests are included.

@MazterQyou MazterQyou requested a review from a team as a code owner August 29, 2023 23:38
@vercel
Copy link

vercel bot commented Aug 29, 2023

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 Aug 30, 2023 0:39am
examples-react-d3 ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2023 0:39am
examples-react-dashboard ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2023 0:39am
examples-react-data-table ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2023 0:39am
examples-react-highcharts ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2023 0:39am
examples-react-material-ui ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2023 0:39am
examples-react-pivot-table ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2023 0:39am
examples-vue-query-builder ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2023 0:39am

@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Patch coverage: 96.92% and project coverage change: +23.88% 🎉

Comparison is base (1e29bb3) 47.15% compared to head (65bca99) 71.04%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #7072       +/-   ##
===========================================
+ Coverage   47.15%   71.04%   +23.88%     
===========================================
  Files         155      306      +151     
  Lines       20589    52632    +32043     
  Branches     5183     5183               
===========================================
+ Hits         9709    37392    +27683     
- Misses      10564    14924     +4360     
  Partials      316      316               
Flag Coverage Δ
cube-backend 47.15% <ø> (ø)
cubesql 86.39% <96.92%> (?)

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

Files Changed Coverage Δ
rust/cubesql/cubesql/src/compile/engine/udf.rs 85.76% <ø> (ø)
rust/cubesql/cubesql/src/compile/mod.rs 93.30% <95.65%> (ø)
...cubesql/cubesql/src/compile/rewrite/rules/split.rs 97.65% <97.61%> (ø)

... and 148 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MazterQyou MazterQyou force-pushed the cubesql/holistics-timestamp-query branch from 6ab8ee4 to 65bca99 Compare August 30, 2023 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant