Skip to content

Commit

Permalink
chore(mql): Fix MQL groupby and filter formula test (#76942)
Browse files Browse the repository at this point in the history
After updating the MQL snuba parser code to support joins for formulas,
this test should be updated by removing `platform` from the groupby
clause since it is already a filter in both `query_1` and `query_2`. If
`platform` also exists in the groupby, then it should not be able to
join and therefore return no data.
  • Loading branch information
enochtangg authored Sep 4, 2024
1 parent d9986b2 commit 891194f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/sentry/sentry_metrics/querying/data/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ def test_query_with_formula_and_filter(self):
results = self.run_query(
mql_queries=[
MQLQuery(
"($query_2 + $query_1) by (platform, transaction)",
"($query_2 + $query_1) by (transaction)",
order=QueryOrder.DESC,
query_1=MQLQuery(query_1),
query_2=MQLQuery(query_2),
Expand All @@ -1345,13 +1345,10 @@ def test_query_with_formula_and_filter(self):
)
data = results["data"]
assert len(data) == 1
assert len(data[0]) == 2
assert data[0][0]["by"] == {"platform": "ios", "transaction": "/hello"}
assert data[0][0]["series"] == [None, 6.0, 3.0]
assert data[0][0]["totals"] == 9.0
assert data[0][1]["by"] == {"platform": "android", "transaction": "/hello"}
assert data[0][1]["series"] == [None, 1.0, 1.0]
assert data[0][1]["totals"] == 2.0
assert len(data[0]) == 1
assert data[0][0]["by"] == {"transaction": "/hello"}
assert data[0][0]["series"] == [None, 7.0, 4.0]
assert data[0][0]["totals"] == 11.0

def test_query_with_basic_formula_and_coercible_units(self):
mri_1 = "d:custom/page_load@nanosecond"
Expand Down

0 comments on commit 891194f

Please sign in to comment.