metabase / metabase

The simplest, fastest way to get business intelligence and analytics to everyone in your company :yum:
https://metabase.com
Other
38.85k stars 5.16k forks source link

[MBQL-lib v2] Query processor conflating nested explicit join and outer implicit join #33972

Open bshepherdson opened 1 year ago

bshepherdson commented 1 year ago

Describe the bug

When a nested query has an explicit join in the original/inner query, and implicit join of the same table in the second/outer query, the returned metadata treats all columns from the explicit join as coming from the implicit join.

These should be kept separate.

To Reproduce

  1. Create a structured query of Orders; join Products, selecting only Category.
  2. Save that question.
  3. Create a new question using the above as the data source.
  4. Run it, then open the column selector.
    • Note that the selected columns correctly include Products -> Category.
  5. Add the Product -> EAN or another field via implicit join.

Expected behavior

These two different joins are kept separate by the QP. Product -> Category is still offered as an implicit join.

Logs

No response

Information about your Metabase installation

`master`

Severity

Trivial

Additional context

You can tell the two sources apart in the UI because the explicitly joined field is supposed to be Products -> Category (named based on the Products table), while the implicitly joined field is Product -> EAN (named based on Orders.PRODUCT_ID).

Before adding the implicit join, it renders as Products -> Category; whereas with the implicit join it renders as Product -> Category and the difference is visible in the cols in the response as well.

ranquild commented 1 year ago

Can still reproduce using the steps from the descriptions. Screenshots from master. The column coming from the data source; but Lib.displayInfo returns selected for both columns.

Screenshot 2023-11-08 at 11 36 09 Screenshot 2023-11-08 at 11 36 14
darksciencebase commented 11 months ago

removing from the board since this will be tackled as part of #36185