Skip to content

FILTER_PARAMS throws "Query parameter number 1 is not defined (0 provided)" error when used in refreshKey #8727

@itestyoy

Description

@itestyoy

Hi! Pre-aggregations throw an error when we use FILTER_PARAMS in the refreshKey

Error:

cube  | Error: Query parameter number 1 is not defined (0 provided) at [3:63]
cube  |     at QueryQueue.parseResult (/cube/node_modules/@cubejs-backend/query-orchestrator/src/orchestrator/QueryQueue.js:394:13)
cube  |     at QueryQueue.executeInQueue (/cube/node_modules/@cubejs-backend/query-orchestrator/src/orchestrator/QueryQueue.js:366:19)
cube  |     at processTicksAndRejections (node:internal/process/task_queues:95:5)
cube  |     at PreAggregationLoadCache.keyQueryResult (/cube/node_modules/@cubejs-backend/query-orchestrator/src/orchestrator/PreAggregations.ts:439:75)
cube  |     at async Promise.all (index 0)
cube  |     at PreAggregationPartitionRangeLoader.loadRangeQuery (/cube/node_modules/@cubejs-backend/query-orchestrator/src/orchestrator/PreAggregations.ts:1573:38)
cube  |     at /cube/node_modules/@cubejs-backend/query-orchestrator/src/orchestrator/PreAggregations.ts:1879:11
cube  |     at async Promise.all (index 0)
cube  |     at PreAggregationPartitionRangeLoader.loadBuildRange (/cube/node_modules/@cubejs-backend/query-orchestrator/src/orchestrator/PreAggregations.ts:1876:36)
cube  |     at PreAggregationPartitionRangeLoader.partitionRanges (/cube/node_modules/@cubejs-backend/query-orchestrator/src/orchestrator/PreAggregations.ts:1835:24)
cube  |     at PreAggregationPartitionRangeLoader.partitionPreAggregations (/cube/node_modules/@cubejs-backend/query-orchestrator/src/orchestrator/PreAggregations.ts:1827:47)
cube  |     at async Promise.all (index 0)
cube  |     at PreAggregations.expandPartitionsInPreAggregations (/cube/node_modules/@cubejs-backend/query-orchestrator/src/orchestrator/PreAggregations.ts:2322:68)
cube  |     at OrchestratorApi.expandPartitionsInPreAggregations (/cube/node_modules/@cubejs-backend/server-core/src/core/OrchestratorApi.ts:277:14)
cube  |     at RefreshScheduler.refreshQueriesForPreAggregation (/cube/node_modules/@cubejs-backend/server-core/src/core/RefreshScheduler.ts:178:24)

Model:

cube('model', {
      public: false,
      title: 'model',
      sql: `select timestamp('2024-01-01') as created_at, 'hello' as dim, timestamp('2024-01-01') updated_at`,

      dimensions: {
          created_at: {
              sql: `created_at`,
              type: `time`
          },

          dim: {
              sql: `dim`,
              type: `string`
          }
      },

      measures: {
          metric: {
              sql: `(1)`,
              type: 'max'
          }
      },

      pre_aggregations: {
          model_0_0_rollup: {
              measures: [
                  CUBE.metric
              ],
              dimensions: [
                  CUBE.dim,
              ],
              time_dimension: CUBE.created_at,
              granularity: `day`,
              external: false,
              partition_granularity: `month`,
              refresh_key: {
                  sql: `SELECT max(updated_at)
                           FROM (select timestamp('2024-01-01') as created_at, 'hello' as dim, timestamp('2024-01-01') updated_at)
                        WHERE ${FILTER_PARAMS.model.created_at.filter("created_at")}`,
              },
          },
      }
});

Version:
0.36.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions