-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Describe the Bug:
When executing a query that includes a multi_stage: true YoY measure (using time_shift) against an external pre-aggregation stored in CubeStore, the /v1/load endpoint returns an internal DataFusion error from CubeStore's ProjectionPushdown optimizer.
Error Message:
{
"error": "Error: Internal: ProjectionPushdown\ncaused by\nInternal error: Could not createExprBoundaries: intry_from_columncol_index\n has gone out of bounds with a value of 6, the schema has 6 columns..\nThis was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker"
}
Environment:
| Component | Version |
|---|---|
| @cubejs-backend/server | 1.6.16 |
| CubeStore | 1.6.16 |
| Node.js | 24.x |
| Database | Trino (Hive catalog) |
| Platform | Linux (Red Hat UBI 9) |
| CUBEJS_TESSERACT_SQL_PLANNER | true |
| CUBEJS_TESSERACT_PRE_AGGREGATIONS | true |
Steps to Reproduce:
- Cube Model (simplified)
cubes:
- name: biz_mkt_volume
sql_table: biz_mkt_volume
data_source: default
dimensions:
- name: src
sql: src
type: string
- name: por_country_cde
sql: por_country_cde
type: string
- name: por_country_nme
sql: por_country_nme
type: string
- name: hs2_code
sql: hs2_code
type: string
- name: hs2_desc
sql: hs2_desc
type: string
- name: dep_arr_date_ts
sql: "date_parse(CAST(dep_arr_date AS VARCHAR), '%Y%m%d')"
type: time
measures:
- name: teu
sql: teu
type: sum
- name: teu_py
type: number
multi_stage: true
sql: "{teu}"
time_shift:
- time_series: dep_arr_date_ts
interval: 1 year
- name: teu_yoy_pct
type: number
multi_stage: true
sql: >
CASE WHEN {teu_py} > 0
THEN ({teu} - {teu_py}) * 100.0 / {teu_py}
ELSE NULL
END
pre_aggregations:
- name: rollup_yoy
type: rollup
measures:
- teu
dimensions:
- src
- por_country_cde
- por_country_nme
- hs2_code
- hs2_desc
time_dimension: dep_arr_date_ts
granularity: year
partition_granularity: year
refresh_key:
every: 1 day
views:
- name: market_volume_fixed_period_comparison
cubes:
- join_path: biz_mkt_volume
includes: "*"
- Environment Variables:
CUBEJS_TESSERACT_SQL_PLANNER=true
CUBEJS_TESSERACT_PRE_AGGREGATIONS=true
CUBEJS_CUBESTORE_HOST=localhost
CUBEJS_CUBESTORE_PORT=3030
- Query sent to POST /cubejs-api/v1/load:
{
query: {
dimensions: [
market_volume_fixed_period_comparison.por_country_cde,
market_volume_fixed_period_comparison.por_country_nme,
market_volume_fixed_period_comparison.hs2_code,
market_volume_fixed_period_comparison.hs2_desc
],
measures: [
market_volume_fixed_period_comparison.teu,
market_volume_fixed_period_comparison.teu_yoy_pct
],
timeDimensions: [
{
dimension: market_volume_fixed_period_comparison.dep_arr_date_ts,
dateRange: [2024-01-01, 2025-12-31],
granularity: year
}
],
filters: [
{
member: market_volume_fixed_period_comparison.src,
operator: equals,
values: [OB]
},
{
member: market_volume_fixed_period_comparison.teu,
operator: gte,
values: [1000]
}
],
limit: 20
}
}
Expected Behavior:
The query returns YoY comparison data (TEU and TEU YoY % change) grouped by country and HS2 code for the selected year range.
Actual Behavior:
CubeStore returns an internal DataFusion ProjectionPushdown error (see above). The query never completes.
Generated SQL (from POST /cubejs-api/v1/sql):