-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
feat(mql): MQL JOIN subquery generator #6101
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…s-subquery-generator
Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time. ❌ Failed Test Results:Completed 1702 tests with View the full list of failed testspytest
|
john-z-yang
approved these changes
Jul 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the last piece for being able to run multi-entity formula metric queries in snuba. This work was first spec'ed in #5717. The main change of this PR is the metrics subquery generator which now supports "MQL shaped" JOINs (see
snuba/query/joins/metrics_subquery_generator.py
). For example, the following query:becomes
See docstring from
generate_metrics_subqueries()
for the reasoning why subqueries should get processed in this way.Additional to the subquery generator change, the indexer_mapping resolver was updated to resolve columns in the
ON
clause. This is because groupby columns get pushed onto the join condition. As a result, tag columns in the join condition must be resolved.Testing
When this PR is merged, nothing changes. We configure the rollout through the runtime config. First, use
run_new_mql_parser
which samples a percentage of MQL queries and runs the new parser which now converts formula queries into JOINs. Then, in the entity processing stage of the pipeline, the metrics subquery generator will execute when it sees this query.SET run_new_mql_parser = 0.01 # 1% of queries try using the new pipeline
Monitor in sentry and DD, and continue increasing run_new_mql_parser until we hit 100%.
After support this is completed, we can remove the old parser and other dead code.