SQL API: Join with CTEs is not working
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
**Failed SQL**
```sql
with this_week as (
SELECT country, MEASURE(num_customers) AS total_customers_this_week
FROM customers
WHERE week_utc = (EXTRACT(YEAR FROM CURRENT_DATE) + 0) * 100 + EXTRACT(WEEK FROM CURRENT_DATE) + 0
GROUP BY country
), last_week as (
SELECT country, MEASURE(num_customers) AS total_customers_last_week
FROM customers
WHERE week_utc = (EXTRACT(YEAR FROM CURRENT_DATE) + 0) * 100 + EXTRACT(WEEK FROM CURRENT_DATE) - 1
GROUP BY country
)
SELECT this_week.country, total_customers_this_week, total_customers_last_week
FROM this_week
join last_week
on this_week.country = last_week.country
```
**Error**
SQL Error [XX000]: ERROR: Error during rewrite: Use `__cubeJoinField` to join Cubes.
**Logical Plan**
Error during planning
**Version:**
v0.35.55
**Additional context**
I see same error when enabling SQL pushdown
Contributor guide
Assessment
This issue has not been assessed yet.