metabase
metabase copied to clipboard
findColumnIndexesFromLegacyRefs doesn't not find legacy columns for nested queries with integer-based field refs
Describe the bug
Blocks https://github.com/metabase/metabase/pull/38820
const [fieldIndex] = Lib.findColumnIndexesFromLegacyRefs(
query,
stageIndex,
fields.map(field => Lib.fromLegacyColumn(query, stageIndex, field)),
[fieldRef],
);
It doesn't find the column if the query is based on a saved question and numeric field ids are used. I believe it has something to do with "broken integer-based" field refs for nested queries, which seems to be handled for regular MLv2 columns (e.g. visibleColumns) but not when converting from a legacy column.
To Reproduce
branch legacy-parameter-target
e2e test e2e/test/scenarios/dashboard-filters/reproductions/12985-dropdown-search.cy.spec.js
relevant code:
const [fieldIndex] = Lib.findColumnIndexesFromLegacyRefs(
query,
stageIndex,
fields.map(field => Lib.fromLegacyColumn(query, stageIndex, field)),
[fieldRef],
);
Expected behavior
findColumnIndexesFromLegacyRefs should find the column
Logs
No response
Information about your Metabase installation
-
Severity
P2
Additional context
No response