cube icon indicating copy to clipboard operation
cube copied to clipboard

feat(cubesql): Support `date_trunc` over column filter with `<=`

Open MazterQyou opened this issue 3 years ago • 1 comments

Check List

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

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

This PR adds support for filters where the left side of an expression is a date_trunc over a column, the right side is a date_trunc with literal expression, the condition between expression is less than (<=), and granularities match. Example: date_trunc('day', column) <= date_trunc('day', literal_date) This expression is effectively the same as column < date_trunc('day', literal_date) + interval '1 day'. It also adds a related test. The PR also contains a fix for interval_mul test, fixing LOCALTIMESTAMP usage result which made the test break over time.

MazterQyou avatar Sep 16 '22 15:09 MazterQyou

Codecov Report

Base: 60.11% // Head: 75.78% // Increases project coverage by +15.66% :tada:

Coverage data is based on head (6a40c73) compared to base (5896c4a). Patch coverage: 98.18% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #5313       +/-   ##
===========================================
+ Coverage   60.11%   75.78%   +15.66%     
===========================================
  Files         140      275      +135     
  Lines       11691    33213    +21522     
  Branches     2859     2859               
===========================================
+ Hits         7028    25169    +18141     
- Misses       4375     7756     +3381     
  Partials      288      288               
Flag Coverage Δ
cube-backend 60.11% <ø> (ø)
cubesql 84.29% <98.18%> (?)

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

Impacted Files Coverage Δ
...cubesql/cubesql/src/compile/rewrite/rules/utils.rs 89.28% <85.71%> (ø)
rust/cubesql/cubesql/src/compile/mod.rs 90.72% <100.00%> (ø)
...besql/cubesql/src/compile/rewrite/rules/filters.rs 93.07% <100.00%> (ø)
.../cubesql/cubeclient/src/models/v1_meta_response.rs 0.00% <0.00%> (ø)
...st/cubesql/cubeclient/src/models/v1_load_result.rs 100.00% <0.00%> (ø)
...formation_schema/postgres/pg_statio_user_tables.rs 93.93% <0.00%> (ø)
...sql/src/compile/engine/information_schema/utils.rs 100.00% <0.00%> (ø)
...engine/information_schema/postgres/pg_attribute.rs 98.50% <0.00%> (ø)
...mpile/engine/information_schema/postgres/tables.rs 97.14% <0.00%> (ø)
.../engine/information_schema/postgres/pg_database.rs 97.46% <0.00%> (ø)
... and 128 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Sep 16 '22 15:09 codecov[bot]