cube-js / cube-js/cube

Error when compiling the cube schema: Cube name in join_path collides with the dimension name

Open
#10,371 1 comment 0 reactions 0 assignees View on GitHub
data modeling data modeling:views
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Describe the bug**

When creating a view with a join path containing a cube with the same name as a dimension of the previous cube, the data model compilation fails with the following error:

```
Unable to load meta data.

Error: Error: Compile errors:
Errors:
test.test2.name cannot be resolved. There's no such member or cube.
```

**To Reproduce**
Steps to reproduce the behavior:
1. Use the Schema bellow
2. Try to query the Data or Metadata
4. See the compilation error

**Expected behavior**

The scheme described below should work without problems

**Minimally reproducible Cube Schema**

```yml
cubes:
- name: "test"
sqlTable: "test"

dimensions:
- name: id
type: string
sql: "id"
primary_key: true
- name: test2
type: string
sql: "test2"

joins:
- name: "test2"
relationship: "many_to_one"
sql: "{CUBE.test2} = {test2.id}"

- name: "test2"
sqlTable: "test2"

dimensions:
- name: id
type: string
sql: "id"
primary_key: true
- name: name
type: string
sql: "name"

views:
- name: v_test

cubes:
- join_path: "test"
prefix: true
includes:
- id
- join_path: "test.test2"
prefix: true
includes:
- name

```

**Version:**
1.6.8

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.