Skip to content

Commit 70dfa52

Browse files
KSDaemonwaralexrom
andauthored
feat(tesseract): Support for time shifts over calendar cubes dimensions (#9758)
* update data model scheme for calendar time shifts + compilation tests * chore(tesseract): Refactoring of time shift without time dimension logic * add timeshift definitions to rust side * implement time shifts over calendar tables * add usefull comment * fix correct sql gen for calendar custom gran but with common timeshift * add tests --------- Co-authored-by: Alexandr Romanenko <alex.romanenko@cube.dev>
1 parent d81c57d commit 70dfa52

File tree

19 files changed

+862
-136
lines changed

19 files changed

+862
-136
lines changed

packages/cubejs-schema-compiler/src/compiler/CubeValidator.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ const timeShiftItemRequired = Joi.object({
575575
});
576576

577577
const timeShiftItemOptional = Joi.object({
578-
timeDimension: Joi.func(), // не required
578+
timeDimension: Joi.func(), // not required
579579
interval: regexTimeInterval.required(),
580580
type: Joi.string().valid('next', 'prior').required(),
581581
});
@@ -661,6 +661,17 @@ const DimensionsSchema = Joi.object().pattern(identifierRegex, Joi.alternatives(
661661
type: Joi.any().valid('number').required(),
662662
sql: Joi.func().required(),
663663
addGroupBy: Joi.func(),
664+
}),
665+
// TODO should be valid only for calendar cubes, but this requires significant refactoring
666+
// of all schemas. Left for the future when we'll switch to zod.
667+
inherit(BaseDimensionWithoutSubQuery, {
668+
type: Joi.any().valid('time').required(),
669+
sql: Joi.func().required(),
670+
timeShift: Joi.array().items(Joi.object({
671+
interval: regexTimeInterval.required(),
672+
type: Joi.string().valid('next', 'prior').required(),
673+
sql: Joi.func().required(),
674+
})),
664675
})
665676
));
666677

0 commit comments

Comments
 (0)