cube
cube copied to clipboard
Internal: Error during planning: Coercion from [Int64Decimal(5), Int64]
Describe the bug I'm trying to query a cube from from playground and get an error.
The interesting point is that when i change granularity all works(added screenshots for comparison).
Works
{
"measures": [
"backoffice.in_out"
],
"timeDimensions": [
{
"dimension": "backoffice.as_of_date",
"granularity": "day",
"dateRange": "Yesterday"
}
],
"order": {
"backoffice.as_of_date": "asc"
}
}
Does not work
"measures": [
"backoffice.in_out"
],
"timeDimensions": [
{
"dimension": "backoffice.as_of_date",
"granularity": "hour",
"dateRange": "Yesterday"
}
],
"order": {
"backoffice.as_of_date": "asc"
}
}
To Reproduce Steps to reproduce the behavior:
- Go to playground
- select measures and time
Expected behavior
Screenshots
Minimally reproducible Cube Schema my cube:
cube(`backoffice`,
{
public: isPublic(`backoffice`, COMPILE_CONTEXT),
sql_table: `aggregate.backoffice`,
measures: {
deposit_amount_eur: {
sql: `deposit_amount_eur`,
type: `sum`
},
withdrawal_amount_eur: {
sql: `withdrawal_amount_eur`,
type: `sum`
},
in_out: {
sql: `1.0 * ${withdrawal_amount_eur} / NULLIF(${deposit_amount_eur}, 0)`,
type: `number`
},
},
dimensions: {
as_of_date: {
sql: `as_of_date`,
type: `time`
},
brand: {
sql: `brand`,
type: `string`
},
channel: {
sql: `channel`,
type: `string`
},
operator_id: {
sql: `operator_id`,
type: `string`
},
currency: {
sql: `currency`,
type: `string`,
format: `currency`
},
risk_business_segment: {
sql: `risk_business_segment`,
type: `string`,
},
player_uid: {
sql: `player_uid`,
type: `string`,
},
traffic: {
sql: `traffic`,
type: `string`,
},
},
dataSource: `default`
}
);
Version: [e.g. 0.33.30]
I'm facing the same problem. And it can be reproduced only when pre-aggregation is enabled. Once it's disabled, everything works good.
however the following hack fixes the issue
${withdrawal_amount_eur} / NULLIF(CAST(${deposit_amount_eur} AS REAL), 0))
is it a problem on datafusion
or cubestore
level ?
@svdimchenko Yep. If you're using calculations on the Cube Store side, you should make sure types will match there.
@paveltiunov Something has been surely broken on Cube lately. I am getting this error on the new table when I am trying to create a ratio metric of two metrics of type sum. I have around 100 other cubes where I use the same syntax to add the ratio metric and they work fine. Can u please point me in the right direction as to what could have been broken here?
@anshjain18 It would help us track down this issue if you'd provide more info.
Which Cube and Cube Store versions do you run?
What is the data source?
What is the data model for the cube in question?
Do you use pre-aggregations?
What is the exact error message?
Does it reproduce consistently?
Can you reproduce it with a cube that has its sql
property defined as SELECT "some_value" AS column_1, "some_value" AS column_2, ...
?
@anshjain18 Is your issue still relevant? Would be great to get more info then.