-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Summarizing with implicit join does not allow subsequent joins and nested query #20519
Labels
.Backend
Priority:P2
Average run of the mill bug
Querying/Nested Queries
Questions based on other saved questions
.Regression
Bugs that were previously fixed and/or bugs unintentionally shipped with new features.
.Reproduced
Issues reproduced in test (usually Cypress)
Type:Bug
Product defects
Milestone
Comments
flamber
added
Type:Bug
Product defects
Priority:P2
Average run of the mill bug
Querying/Nested Queries
Questions based on other saved questions
.Backend
.Regression
Bugs that were previously fixed and/or bugs unintentionally shipped with new features.
labels
Feb 15, 2022
nemanjaglumac
added a commit
that referenced
this issue
Feb 15, 2022
…t joins and nested query (#20521) * Add repro for #20519 * Update frontend/test/metabase/scenarios/joins/reproductions/20519-cannot-join-on-aggregation-with-implicit-joins-and-nested-query.cy.spec.js Co-authored-by: flamber <1447303+flamber@users.noreply.github.com> * Update frontend/test/metabase/scenarios/joins/reproductions/20519-cannot-join-on-aggregation-with-implicit-joins-and-nested-query.cy.spec.js Co-authored-by: flamber <1447303+flamber@users.noreply.github.com> Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
github-actions bot
pushed a commit
that referenced
this issue
Feb 15, 2022
…t joins and nested query (#20521) * Add repro for #20519 * Update frontend/test/metabase/scenarios/joins/reproductions/20519-cannot-join-on-aggregation-with-implicit-joins-and-nested-query.cy.spec.js Co-authored-by: flamber <1447303+flamber@users.noreply.github.com> * Update frontend/test/metabase/scenarios/joins/reproductions/20519-cannot-join-on-aggregation-with-implicit-joins-and-nested-query.cy.spec.js Co-authored-by: flamber <1447303+flamber@users.noreply.github.com> Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
nemanjaglumac
added a commit
that referenced
this issue
Feb 15, 2022
…t joins and nested query (#20521) (#20530) * Add repro for #20519 * Update frontend/test/metabase/scenarios/joins/reproductions/20519-cannot-join-on-aggregation-with-implicit-joins-and-nested-query.cy.spec.js Co-authored-by: flamber <1447303+flamber@users.noreply.github.com> * Update frontend/test/metabase/scenarios/joins/reproductions/20519-cannot-join-on-aggregation-with-implicit-joins-and-nested-query.cy.spec.js Co-authored-by: flamber <1447303+flamber@users.noreply.github.com> Co-authored-by: flamber <1447303+flamber@users.noreply.github.com> Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com> Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
From the error message, here's the SQL it's generating: SELECT
"source"."PRODUCTS__via__PRODUCT_ID__CATEGORY" AS "PRODUCTS__via__PRODUCT_ID__CATEGORY",
"source"."count" AS "count",
(1 + 1) AS CC,
"Products".ID AS "Products__ID",
"Products".TITLE AS "Products__TITLE",
"Products".CATEGORY AS "Products__CATEGORY",
"Products".VENDOR AS "Products__VENDOR",
"Products".PRICE AS "Products__PRICE",
"Products".RATING AS "Products__RATING",
"Products".CREATED_AT AS "Products__CREATED_AT",
"source"."PRODUCTS__via__PRODUCT_ID__ID" AS "PRODUCTS__via__PRODUCT_ID__ID"
FROM (
SELECT
"PRODUCTS__via__PRODUCT_ID".CATEGORY AS "PRODUCTS__via__PRODUCT_ID__CATEGORY",
COUNT(*) AS "count"
FROM PUBLIC.ORDERS
LEFT OUTER JOIN PUBLIC.PRODUCTS "PRODUCTS__via__PRODUCT_ID"
ON PUBLIC.ORDERS.PRODUCT_ID = "PRODUCTS__via__PRODUCT_ID".ID
GROUP BY "PRODUCTS__via__PRODUCT_ID".CATEGORY
ORDER BY 1
) "source"
LEFT OUTER JOIN PUBLIC.PRODUCTS "Products"
ON "source"."PRODUCTS__via__PRODUCT_ID__CATEGORY" = "Products".CATEGORY It's a little unclear why it's trying to include "source"."PRODUCTS__via__PRODUCT_ID__ID" AS "PRODUCTS__via__PRODUCT_ID__ID" in the top level since it's neither available nor needed for anything there. I'll investigate. |
camsaul
added a commit
that referenced
this issue
Feb 23, 2022
) * Fix #20519 * Fix busted indentation
camsaul
added a commit
that referenced
this issue
Feb 23, 2022
) * Fix #20519 * Fix busted indentation
alxnddr
pushed a commit
that referenced
this issue
Feb 24, 2022
) * Fix #20519 * Fix busted indentation
This was referenced Mar 20, 2023
This was referenced May 7, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
.Backend
Priority:P2
Average run of the mill bug
Querying/Nested Queries
Questions based on other saved questions
.Regression
Bugs that were previously fixed and/or bugs unintentionally shipped with new features.
.Reproduced
Issues reproduced in test (usually Cypress)
Type:Bug
Product defects
Describe the bug
Almost a repeat of #17767, just with another nesting. It's possible to trigger something similar following #18512 and adding Custom Column to the third combining question.
Regression since 0.39.4
Workaround is to use explicit joins.
To Reproduce
1 + 1
as "CC" (just to trigger nested query) - errors withColumn "source.PRODUCTS__via__PRODUCT_ID__ID" not found;
(different database types might error slightly differently)Full stacktrace
Information about your Metabase Installation:
Tested 0.39.3 thru 0.42.0
The text was updated successfully, but these errors were encountered: