File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
packages/cubejs-schema-compiler Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ const ContextEvaluator = require('./ContextEvaluator');
9
9
const DashboardTemplateEvaluator = require ( './DashboardTemplateEvaluator' ) ;
10
10
const JoinGraph = require ( './JoinGraph' ) ;
11
11
const Funnels = require ( '../extensions/Funnels' ) ;
12
+ const RefreshKeys = require ( '../extensions/RefreshKeys' ) ;
12
13
const CubeToMetaTransformer = require ( './CubeToMetaTransformer' ) ;
13
14
14
15
exports . compile = ( repo , options ) => {
@@ -36,7 +37,8 @@ exports.prepareCompiler = (repo, options) => {
36
37
dashboardTemplateCompilers : [ dashboardTemplateEvaluator ] ,
37
38
cubeFactory : cubeSymbols . createCube . bind ( cubeSymbols ) ,
38
39
extensions : {
39
- Funnels
40
+ Funnels,
41
+ RefreshKeys
40
42
}
41
43
} , options ) ) ;
42
44
return {
Original file line number Diff line number Diff line change
1
+ class RefreshKeys {
2
+ constructor ( cubeFactory , compiler ) {
3
+ this . cubeFactory = cubeFactory ;
4
+ this . compiler = compiler ;
5
+ this . immutablePartitionedRollupKey = this . immutablePartitionedRollupKey . bind ( this ) ;
6
+ }
7
+
8
+ immutablePartitionedRollupKey ( scalarValue ) {
9
+ return {
10
+ sql : ( FILTER_PARAMS ) => `SELECT ${ this . compiler . contextQuery ( ) . caseWhenStatement ( [ {
11
+ sql : FILTER_PARAMS [
12
+ this . compiler . contextQuery ( ) . timeDimensions [ 0 ] . path ( ) [ 0 ]
13
+ ] [
14
+ this . compiler . contextQuery ( ) . timeDimensions [ 0 ] . path ( ) [ 1 ]
15
+ ] . filter (
16
+ ( from , to ) => `${ this . compiler . contextQuery ( ) . nowTimestampSql ( ) } < ${ this . compiler . contextQuery ( ) . timeStampCast ( to ) } `
17
+ ) ,
18
+ label : scalarValue
19
+ } ] ) } `
20
+ } ;
21
+ }
22
+ }
23
+
24
+ module . exports = RefreshKeys ;
You can’t perform that action at this time.
0 commit comments