metricflow
metricflow copied to clipboard
Metrics accepting multiple measures can fail if no group by elements requested
Describe the bug When we have a metric based on multiple measures originating from different data sources, such as a ratio metric with a numerator and denominator computed from different tables or with different constraints, queries against that metric will fail if no group by element is requested.
As a practical matter this should be quite rare for the following reasons:
- The CLI does not allow a query with an empty dimension list
- The dominant majority of queries for metrics will group them by metric_time (or some other relevant time dimension), since Metricflow's initial metric offering is fundamentally built around measures computed across time
Steps To Reproduce Steps to reproduce the behavior:
- Add a test case to the configured test case config or the dataflow to sql plan conversion tests for bookings_per_listing with no dimensions selected
- Observe the rendered SQL generates an empty ON statement in the join
- Presumably the query will also fail, haven't tried running it
Expected behavior We'd expect the join to be written correctly for this case, or else for such queries to be disallowed at the API level and to fail with a helpful error message.
Version: Metricflow 0.100.2