cube-js/cube

Rollup Designer & Documentation Don't Match CubeValidator updateWindow Options

Open

#3,586 opened on Oct 26, 2021

View on GitHub
 (7 comments) (1 reaction) (0 assignees)Rust (19,563 stars) (1,965 forks)batch import
help wantedpre-aggregations

Description

Describe the bug When I use the Rollup Designer or look at the documentation, it seems to indicate that we can use "month", "quarter", or "year" as an updateWindow time interval, however I get a compile error when I try to run this:

Error: Compile errors: Main cube: (preAggregations.monthlyAggregation.refreshKey.updateWindow = 1 quarter) does not match regexp: /^(\d+) (second|minute|hour|day|week)s?$/ at ErrorReporter.throwIfAny (/home/bgiles/main.cubejs/node_modules/@cubejs-backend/schema-compiler/src/compiler/ErrorReporter.ts:127:13) at DataSchemaCompiler.throwIfAnyErrors (/home/bgiles/main.cubejs/node_modules/@cubejs-backend/schema-compiler/src/compiler/DataSchemaCompiler.js:147:23) at /home/bgiles/main.cubejs/node_modules/@cubejs-backend/schema-compiler/src/compiler/DataSchemaCompiler.js:67:16 at CompilerApi.metaConfig (/home/bgiles/main.cubejs/node_modules/@cubejs-backend/server-core/src/core/CompilerApi.js:142:13) at ApiGateway.meta (/home/bgiles/main.cubejs/node_modules/@cubejs-backend/api-gateway/src/gateway.ts:474:26) at /home/bgiles/main.cubejs/node_modules/@cubejs-backend/api-gateway/src/gateway.ts:319:7

The pre aggregation documentation also seems to also imply that these time intervals are valid options: https://cube.dev/docs/schema/reference/pre-aggregations#granularity https://cube.dev/docs/schema/reference/pre-aggregations#partition-granularity

Both the granularity and partitionGranularity parameters highlight that "month", "quarter", and "year" are valid time intervals and there's no specific list of options for updateWindow that would indicate a different list of options for this parameter.

To Reproduce Steps to reproduce the behavior:

  1. Set updateWindow on a pre aggregation to use "month", "quarter", or "year"

Expected behavior "month", "quarter", and "year" time intervals are valid updateWindows.

Screenshots image

Version: "@cubejs-backend/cubestore-driver": "0.28.49", "@cubejs-backend/mssql-driver": "0.28.47", "@cubejs-backend/server": "0.28.49"

Additional context It looks like the validation fails here: https://github.com/cube-js/cube.js/blob/858b7fa2dbc5ed08350a6f875189f6f608c6d55c/packages/cubejs-schema-compiler/src/compiler/CubeValidator.js#L147 because everyInterval (https://github.com/cube-js/cube.js/blob/858b7fa2dbc5ed08350a6f875189f6f608c6d55c/packages/cubejs-schema-compiler/src/compiler/CubeValidator.js#L29-L35) does not include these time intervals in the regexp match. If it's as simple as updating this validation, then it should be an easy change, but I'm not sure whether these time intervals are actually implemented for updateWindow.

Contributor guide