Skip to content

Commit 6301482

Browse files
committed
test(tesseract): use member refs in active_count to actually trigger bug
The `active_count` measure was defined with `sql: "{CUBE}.id"` and filter `sql: "{CUBE}.name LIKE 'A%'"`. Both forms parse to `SqlDependency::CubeRef` only — no `SqlDependency::Symbol` on the `id` or `name` dimensions. The FK-aggregate bug only manifests when the measure transitively pulls a primary-key dimension into the outer factory's `render_references` (via a Symbol dep), which is what makes the join condition's RHS misresolve to the inner `keys` subquery. Switch to `sql: "{id}"` and filter `sql: "{name} LIKE 'A%'"` — these are member references that produce Symbol deps on the dimensions, so `references_builder.resolve_references_for_member` recursively populates render_references for the PK. This matches the original production bug shape (`sql: "{primary_key}"` with filters) and genuinely exercises the buggy code path. With the fix in place the join condition correctly resolves to `keys.<pk> = pk_cube_alias.<col>`; without the fix it would collapse to `keys.<pk> = keys.<pk>`.
1 parent 2a38389 commit 6301482

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

rust/cubesqlplanner/cubesqlplanner/src/test_fixtures/schemas/yaml_files/common/integration_multi_fact.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ cubes:
5252
- sql: "{regions.name} = 'East'"
5353
- name: active_count
5454
type: count
55-
sql: "{CUBE}.id"
55+
sql: "{id}"
5656
filters:
57-
- sql: "{CUBE}.name LIKE 'A%'"
57+
- sql: "{name} LIKE 'A%'"
5858

5959
- name: orders
6060
sql: "SELECT * FROM orders"

0 commit comments

Comments
 (0)