[英]CubeJs Preaggregation index fail to compile
I want to put an index on my rollup pre-aggregation cube js table:我想在我的汇总预聚合多维数据集 js 表上放置一个索引:
preAggregations: {
projectDate: {
type: `rollup`,
measureReferences: [count, amount],
dimensionReferences: [state, Projects.slug],
timeDimensionReference: confirmedAt,
granularity: `day`,
refreshKey: {
every: '1 day'
},
indexes: {
main: {
columns: [state]
}
}
},
}
However, the cube does not compile and I get the following error:但是,多维数据集无法编译,并且出现以下错误:
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
My state
dimension is well defined, and the preaggregation works when I remove the index.我的
state
维度定义明确,当我删除索引时预聚合有效。 Here is the schema:这是架构:
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`,
measureReferences: [count, amount],
dimensionReferences: [state, Projects.slug],
timeDimensionReference: confirmedAt,
granularity: `day`,
refreshKey: {
every: '1 day'
},
index: {
main: {
columns: [state]
}
}
},
}
});
Do you know what could I've mis-declared or omitted?你知道我可能错误地声明或遗漏了什么吗?
I used the example given in the doc: https://cube.dev/docs/pre-aggregations#indexes我使用了文档中给出的示例: https://cube.dev/docs/pre-aggregations#indexes
Could you please update version and try again?能否请您更新版本并重试? I'm almost sure you are using an old version of cube.js
我几乎可以肯定您使用的是旧版本的 cube.js
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.