Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message when joining original sql pre-aggregation to some non-aggregated data #1181

Open
mkwatson opened this issue Oct 6, 2020 · 1 comment
Labels
backend:server Issues relating to Cube Core's Server bug Something isn't working Roadmap: 2021 Q1 Cube.js team roadmap for Q1 of 2021.

Comments

@mkwatson
Copy link

mkwatson commented Oct 6, 2020

Describe the bug
you can't use original sql pre-aggregation and join to some non-aggregated data. When you try to, Cube attempts to join with the main, analytics database and the pre-agg database (which could be external).

To Reproduce

SELECT date_trunc('day', (cast("t1".report_date AS TIMESTAMP)::timestamptz AT TIME ZONE 'UTC')) "t1__report_date_day",
       sum("t1".sales) "t1__sales"
FROM ananlytics_db.t1 AS "t1"
LEFT JOIN stb_pre_aggregations_dev.companies_main_rc4lezhz_aljrstgp_1fnp97r AS "companies" ON "t1".company_id = "companies".id
WHERE (cast("t1".report_date AS TIMESTAMP) > $1::timestamptz)
  AND ("companies".company_id = $2)
GROUP BY 1
ORDER BY 1 DESC LIMIT 10000
ERROR:  relation "ananlytics_db.t1" does not exist

Expected behavior
Throw a warning with a descriptive message, not try to perform a query in the preagg db that will throw an exception.

Version:
0.20.12

@paveltiunov
Copy link
Member

@mkwatson Hey Mark! Thanks for posting this! We should provide a clear message that states originalSql pre-aggregations in external databases cannot be joined with raw data in the main database.

@paveltiunov paveltiunov added the bug Something isn't working label Oct 7, 2020
@rpaik rpaik added pr:community Contribution from Cube.js community members. and removed pr:community Contribution from Cube.js community members. labels Oct 21, 2020
@keydunov keydunov added Roadmap: 2021 Q1 Cube.js team roadmap for Q1 of 2021. and removed Roadmap: 2020 Q4 labels Jan 6, 2021
@hassankhan hassankhan added the backend:server Issues relating to Cube Core's Server label May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:server Issues relating to Cube Core's Server bug Something isn't working Roadmap: 2021 Q1 Cube.js team roadmap for Q1 of 2021.
Projects
None yet
Development

No branches or pull requests

6 participants