Skip to content

πŸ› Bug: FILTER_PARAMS not populated for inDateRange filter on joined cube (regression from v0.33 to v1.3.36)Β #9780

@divij123

Description

@divij123

Describe the bug

We have two cubes:

  • User (base cube)
  • Conversation (joined via User.id = Conversation.user_id, 1:many)

Our business use case requires fetching all Users who have done 0 conversations within the last 30 days.
To do this, we need to apply a subquery filter on the Conversation's created date range when it’s joined to User.

This used to work correctly in Cube.js v0.33, but after upgrading to v1.3.36, the generated SQL no longer receives populated FILTER_PARAMS for the inDateRange filter, which breaks our subquery-based approach.

To Reproduce
Steps to reproduce the behavior:

  1. Start the playground server (make sure you're on v1.3.36)
  2. Copy and add this query
{
  "measures": [
    "Conversation.count_include_zero"
  ],
  "dimensions": [
    "User.id"
  ],
  "timeDimensions": [],
  "timezone": "Asia/Kolkata",
  "limit": 5000,
  "filters": [
    {
      "member": "User.organization_id",
      "operator": "equals",
      "values": ["1"]
    },
    {
      "or": [
        {
          "member": "Conversation.created",
          "operator": "inDateRange",
          "values": [
            "2025-06-15T00:00:00.000",
            "2025-07-14T23:59:59.999"
          ]
        },
        {
          "member": "Conversation.created",
          "operator": "notSet"
        }
      ]
    }
  ]
}
  1. Go to Generated SQL, you'll notice that the FILTER_PARAMS did not get populated in the subquery

Expected behavior
Cube.js should generate SQL similar to:

SELECT
  "user".id,
  count("conversation".id) as conversation_count 
FROM tenant_user as "user"
  LEFT JOIN (
    SELECT * FROM tenant_conversation
    WHERE 1=1 AND (
      (created < ? AND created > ?)
      OR created IS NULL
    )
  ) as "conversation"
    ON "user".id = "conversation".user_id
WHERE
  "user".organization_id = 1
  AND (
    (
      "conversation".created >= ? :: timestamp_tz
      AND "conversation".created <= ? :: timestamp_tz
    )
    OR ("conversation".created IS NULL)
  )
GROUP BY 1

Screenshots
Bug screenshot in the latest version

filter_param bug

Minimally reproducible Cube Schema
In case your bug report is data modelling related please put your minimally reproducible Cube Schema here.
You can use selects without tables in order to achieve that as follows.

// cubes/User.js
cube(`User`, {
  sql: `SELECT * FROM tenant_user`,

  joins: {
    Conversation: {
      relationship: `one_to_many`,
      sql: `${CUBE}.id = ${Conversation.user_id}`
    }
  },

  measures: {
    count: {
      type: `count`,
      drillMembers: [id]
    }
  },

  dimensions: {
    id: {
      sql: `id`,
      type: `number`,
      primaryKey: true
    },
    organization_id: {
      sql: `organization_id`,
      type: `number`
    }
  }
});

// cubes/Conversation.js
cube(`Conversation`, {
  sql: `SELECT * FROM tenant_conversation where ${FILTER_PARAMS.Conversation.created.filter("created")}`,

  measures: {
    count_include_zero: {
      type: `count`,
      sql: `id`,
    }
  },

  dimensions: {
    id: {
      sql: `id`,
      type: `number`,
      primaryKey: true
    },
    user_id: {
      sql: `user_id`,
      type: `number`
    },
    created: {
      sql: `created`,
      type: `time`
    }
  }
});

Version:
[1.3.36]

Additional context

❌ Actual behavior

Since upgrading to v1.3.36:

  • The FILTER_PARAMS.Conversation.created.inDateRange is missing or empty.
  • This breaks our count_include_zero measure that relies on it to apply the subquery date filter.
  • The generated SQL does not include the correct subquery or date filter.

πŸ“¦ Regression

Version Status
v0.33 βœ… Works
v1.3.36 ❌ Broken

πŸ›  Environment

Item Version
Cube.js v1.3.36
Database Snowflake
Node.js 22.14.0

This functionality is critical for supporting zero data reporting on users in a specific time range, which is a common business scenario.

Metadata

Metadata

Assignees

Labels

questionThe issue is a question. Please use Stack Overflow for questions.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions