dbt converter loses derived metric time-context semantics in MetricFlow to Ossie conversion

Open
#317 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
64/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python

Research direction

Locate the MetricFlow-to-Ossie derived-metric conversion and the existing CUMULATIVE_SEMANTICS_LOSS handling. Review the converter tests for derived metrics, then cover offset windows, offset-to-grain, rolling-window, and grain-to-date inputs. Done means a ConverterIssue identifies the affected metric whenever these semantics cannot be preserved.

Written by the indexing model from the issue text.

Description

Problem

The MetricFlow → Ossie converter can silently lose time-context semantics from derived metrics.

For example, a month-over-month metric can use an offset input:

- name: month_over_month_growth
  type: derived
  type_params:
    expr: (cur - pre) / pre
    metrics:
      - name: revenue
        alias: cur
      - name: revenue
        alias: pre
        offset_window:
          count: 1
          granularity: month

The current converter flattens this into an ordinary Ossie SQL expression:

(SUM(orders.amount) - SUM(orders.amount)) / SUM(orders.amount)

The pre offset semantics are lost. A top-level cumulative metric emits CUMULATIVE_SEMANTICS_LOSS, but a derived metric using offset-period inputs does not emit an equivalent warning.

Expected behavior

The converter should report a ConverterIssue for derived metrics using non-portable time-context semantics, including offset_window, offset_to_grain, rolling windows, and grain-to-date semantics. The warning should identify the metric whose semantics were lost.

Strict mode could fail conversion instead of emitting a potentially misleading ordinary SQL expression.

Dominant language
Python
Stars
2.2k
Forks
280
Avg merge
2d 7h
Merged PRs (30d)
32

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/ossie

All issues in apache/ossie

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.