cube icon indicating copy to clipboard operation
cube copied to clipboard

feat(cubejs): LambdaView: hybrid query of source tables and pre-aggregation tables.

Open cristipp opened this issue 2 years ago • 1 comments

Check List

  • [x] Tests have 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
  • [ ] Docs have been added / updated if required

Issue Reference this PR resolves

N/A

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

When querying a cube with a time dimension, and a preaggregation that defines buildRangeEnd, usually as NOW() - x days and lambdaView: true, performs a hybrid query, merging rows from both the preaggregation (before buildRangeEnd) and the source table (after the buildRangeEnd).

From the user's perspective, it appears as if the Cube.js queries the up-to-date underlying table, with all the rows inserted /after/ the pre-aggregation was built present in the final result set. Fast, cheap, up-to-date: pick 3.

cristipp avatar Jun 06 '22 20:06 cristipp

Codecov Report

Merging #4718 (42997f7) into master (769104e) will decrease coverage by 0.20%. The diff coverage is 47.93%.

@@            Coverage Diff             @@
##           master    #4718      +/-   ##
==========================================
- Coverage   60.25%   60.04%   -0.21%     
==========================================
  Files         139      139              
  Lines       11488    11568      +80     
  Branches     2803     2826      +23     
==========================================
+ Hits         6922     6946      +24     
- Misses       4275     4329      +54     
- Partials      291      293       +2     
Flag Coverage Δ
cube-backend 60.04% <47.93%> (-0.21%) :arrow_down:

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

Impacted Files Coverage Δ
packages/cubejs-backend-shared/src/env.ts 30.48% <0.00%> (-0.17%) :arrow_down:
...-query-orchestrator/src/orchestrator/QueryQueue.js 69.20% <ø> (ø)
...bejs-schema-compiler/src/compiler/CubeValidator.js 97.52% <ø> (ø)
...ackages/cubejs-server-core/src/core/CompilerApi.js 82.79% <ø> (ø)
...ejs-schema-compiler/src/adapter/PreAggregations.js 59.10% <25.00%> (-0.29%) :arrow_down:
...-query-orchestrator/src/orchestrator/QueryCache.ts 73.98% <29.16%> (-4.95%) :arrow_down:
...es/cubejs-schema-compiler/src/adapter/BaseQuery.js 68.03% <31.81%> (-0.72%) :arrow_down:
...ackages/cubejs-server-core/src/core/OptsHandler.ts 87.60% <50.00%> (-0.64%) :arrow_down:
...y-orchestrator/src/orchestrator/PreAggregations.ts 79.62% <59.01%> (-1.84%) :arrow_down:
packages/cubejs-api-gateway/src/gateway.ts 69.23% <100.00%> (ø)
... and 3 more

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

codecov[bot] avatar Jun 06 '22 21:06 codecov[bot]