Skip to content

Conversation

@lvauvillier
Copy link
Contributor

Fix: Time dimension column names in pre-aggregation index definitions

Problem

When a time dimension (e.g. publishedAt) is referenced in a pre-aggregation aggregate index's columns, evaluateIndexColumns() generates the wrong column name. The actual pre-aggregation table column is events__published_at_day (single underscore before granularity), but evaluateIndexColumns() produces:

  • events__published_at (no granularity suffix) when using publishedAt

CubeStore rejects the index with Column not found because neither matches the actual table column.

Root cause

BaseTimeDimension.unescapedAliasName() builds the table column as aliasName(dimension) + "_" + granularity (single underscore concatenation), but evaluateIndexColumns() had no awareness of time dimension granularities.

Fix

Updated evaluateIndexColumns() in BaseQuery.js:

The pre-aggregation's timeDimensions references (containing both dimension path and granularity) are now passed into evaluateIndexColumns(). When a column matches a time dimension, _${granularity} is appended.

How to reproduce

Define a rollup pre-aggregation with an aggregate index that includes a time dimension:

pre_aggregations:
  - name: master
    type: rollup
    measures: [revenue, requests]
    dimensions: [accountId]
    time_dimension: publishedAt
    granularity: day
    partition_granularity: day
    indexes:
      - name: myIndex
        columns:
          - publishedAt
          - accountId
        type: aggregate

@lvauvillier lvauvillier requested a review from a team as a code owner February 5, 2026 14:42
@github-actions github-actions bot added javascript Pull requests that update Javascript code pr:community Contribution from Cube.js community members. labels Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update Javascript code pr:community Contribution from Cube.js community members.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant