如何解决CubeJs预聚合索引无法编译
我想在我的汇总预聚合多维数据集js表上放置一个索引:
preAggregations: {
projectDate: {
type: `rollup`,measureReferences: [count,amount],dimensionReferences: [state,Projects.slug],timeDimensionReference: confirmedAt,granularity: `day`,refreshKey: {
every: '1 day'
},indexes: {
main: {
columns: [state]
}
}
},}
但是,多维数据集无法编译,并且出现以下错误:
Error: Compile errors:
ShopperOrders.js:84
columns: [state]
^
ReferenceError: state is not defined
at ShopperOrders.js:84:21
at Script.runInContext (vm.js:127:20)
at Script.runInNewContext (vm.js:133:17)
at Object.runInNewContext (vm.js:299:38)
at DataSchemaCompiler.compileFile
我的state
维度定义明确,当删除索引时,预聚合有效。这是模式:
cube(`ShopperOrders`,{
sql: `SELECT * FROM shopper_orders`,joins: {
ShopperOrderLines: {
sql: `${CUBE}.id = ${ShopperOrderLines}.order_id`,relationship: `hasMany`
}
},measures: {
count: {
type: `count`
},amount: {
sql: `amount`,type: `sum`
},},dimensions: {
id: {
sql: `id`,type: `number`,primaryKey: true
},state: {
sql: `state`,type: `string`
},confirmedAt: {
sql: `confirmed_at`,type: `time`
}
},preAggregations: {
projectDate: {
type: `rollup`,index: {
main: {
columns: [state]
}
}
},}
});
您知道我可能会误声明或忽略什么吗?
我使用了文档中给出的示例: https://cube.dev/docs/pre-aggregations#indexes
解决方法
能否请您更新版本并重试? 我几乎可以确定您使用的是旧版本的cube.js
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。