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

[CT-3541] [Bug] Duplicate Metric InputMeasures cause query time errors in MetricFlow #9360

Closed
2 tasks done
Tracked by #9116
QMalcolm opened this issue Jan 10, 2024 · 1 comment · Fixed by #9677
Closed
2 tasks done
Tracked by #9116
Assignees
Labels
backport 1.7.latest bug Something isn't working High Severity bug with significant impact that should be resolved in a reasonable timeframe Impact: SL
Milestone

Comments

@QMalcolm
Copy link
Contributor

QMalcolm commented Jan 10, 2024

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

After parsing a metric, we process a metric to populate it's input_measures. This happens in _process_metric_node. It's possible for there to be duplicate input measures in the input_measures list. When there is, a validation warning shows up in the output. Additionally on the MetricFlow side, this causes a query time error for the metric.

Expected Behavior

There shouldn't be duplicate InputMeasures in a Metric's Metric.type_params.input_measures and thus no validation warning should be raised.

Steps To Reproduce

  1. Add a ratio metric that depends on two simple metrics that have the same underlying measure
    a. Alternatively pull down my qmalcolm--duplicate-input-measure-repro from jaffle-sl-template
  2. Run dbt parse
  3. Observe validation warning in output

Relevant log output

PydanticMetric ratio_new_customers has multiple identical input measures specifications for measure customers_with_orders. This might be hiding a semantic error. Input measure specification: name='customers_with_orders' filter=None alias=None join_to_timespine=False fill_nulls_with=None.

Environment

- OS: macOS (Sonoma 14.2)
- Python: 3.8
- dbt: 1.7.4

Which database adapter are you using with dbt?

snowflake

Additional Context

The Semantic Layer team, is going to work on mitigating this in MetricFlow as an immediate fix, however we should also fix this on the Core side.

@QMalcolm QMalcolm added bug Something isn't working triage Impact: SL labels Jan 10, 2024
@github-actions github-actions bot changed the title [Bug] Duplicate Metric InputMeasures cause query time errors in MetricFlow [CT-3541] [Bug] Duplicate Metric InputMeasures cause query time errors in MetricFlow Jan 10, 2024
@QMalcolm
Copy link
Contributor Author

Additionally I would be a proponent of getting the fix backported to 1.7.latest

@dbeatty10 dbeatty10 removed the triage label Jan 10, 2024
@graciegoheen graciegoheen added backport 1.7.latest High Severity bug with significant impact that should be resolved in a reasonable timeframe labels Jan 18, 2024
@martynydbt martynydbt added this to the v1.8 milestone Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.7.latest bug Something isn't working High Severity bug with significant impact that should be resolved in a reasonable timeframe Impact: SL
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants