-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Describe the bug
In JavaScript-based data models, strings are accepted in the list of dimensions in a pre-aggregation definition. This data model compiles but fails at runtime, when the query comes.
Removing the backticks around w_merchant_id fixes it:
dimensions: [
`w_merchant_id`
],To Reproduce
Steps to reproduce the behavior:
- Use the following data model.
- Run a query.
{
"dimensions": [
"my_stores.account_id"
],
"order": {
"my_stores.account_id": "asc"
}
}- See the error.
Typepath.join is not a function
TypeError: path.join is not a function
at CubeEvaluator.byPathAnyType (/cube/node_modules/@cubejs-backend/schema-compiler/src/compiler/CubeEvaluator.ts:356:55)
at CubeEvaluator.parsePathAnyType (/cube/node_modules/@cubejs-backend/schema-compiler/src/compiler/CubeEvaluator.ts:392:10)
at /cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/PreAggregations.js:909:75
at Array.map (<anonymous>)
at PreAggregations.cubesFromPreAggregation (/cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/PreAggregations.js:909:41)
...
Expected behavior
This data model should fail at compile time with a clear error message.
Minimally reproducible Cube Schema
cube(`my_orders`, {
sql_table: `public.my_orders`,
dimensions: {
w_merchant_id: {
sql: `w_merchant_id`,
type: `number`,
primary_key: true,
public: true,
},
},
pre_aggregations: {
orders_rollup: {
type: `rollup`,
dimensions: [
`w_merchant_id`
],
},
}});
cube(`my_stores`,
{
sql_table: `public.my_stores`,
dimensions: {
account_id: {
sql: `account_id`,
type: `string`,
},
},
joins: {
my_orders: {
sql: `${account_id} = ${my_orders.w_merchant_id}`,
relationship: `one_to_many`,
}
},
pre_aggregations: {
stores_rollup: {
type: `rollup`,
dimensions: [
account_id,
],
},
combined_rollup: {
type: `rollup_join`,
dimensions: [
account_id,
my_orders.w_merchant_id,
],
rollups: [
my_orders.orders_rollup,
stores_rollup
]
},
},
}
);Version:
v1.1.16
Additional context
Reported by Embeddable in Slack: https://cube-js.slack.com/archives/C04KDTE2EF7/p1737652681703019