Indexing CubeJs预聚合索引无法编译
我想在我的汇总预聚合多维数据集js表上放置一个索引:Indexing CubeJs预聚合索引无法编译,indexing,cube.js,Indexing,Cube.js,我想在我的汇总预聚合多维数据集js表上放置一个索引: preAggregations: { projectDate: { type: `rollup`, measureReferences: [count, amount], dimensionReferences: [state, Projects.slug], timeDimensionReference: confirmedAt, granularity: `day`,
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
我的状态
维度定义得很好,当我删除索引时,预聚合就起作用了。以下是模式:
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]
}
}
},
}
});
你知道我会错报或漏报什么吗
我使用了文档中给出的示例:
请更新版本,然后再试一次好吗?
我几乎可以肯定你使用的是一个旧版本的cube.js共享整个cube.js架构在这里会很有帮助。我编辑了这个问题以共享cube.js架构hi,请检查你的架构的有效性。我怀疑问题可能是您需要使用
索引
参数而不是索引
我也尝试了索引
,但我得到了相同的结果。我将多维数据集软件包的版本从0.15.0
升级到0.20.0
,效果非常好!谢谢