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

[Metrics V2] Query processor handle no join strategy #42666

Merged
merged 7 commits into from
May 16, 2024

Conversation

snoe
Copy link
Contributor

@snoe snoe commented May 14, 2024

Fixes #42667

Make QP preprocessor handle queries referencing metrics in the style of legacy metrics. Enforce various compatibility checks.

Fixes #42462

Make QP preprocessor handle queries referencing metrics in the style of
legacy metrics. Enforce various compatibility checks.
@snoe snoe added the .Team/QueryProcessor :hammer_and_wrench: label May 14, 2024
@snoe snoe requested a review from a team May 14, 2024 22:22
@snoe snoe self-assigned this May 14, 2024
@snoe snoe requested a review from camsaul as a code owner May 14, 2024 22:22
Copy link

replay-io bot commented May 14, 2024

Status Complete ↗︎
Commit 1b0da19
Results
⚠️ 8 Flaky
2510 Passed

Copy link
Contributor

@metamben metamben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I have a few questions. Also, I would prefer to have test cases explicitly testing and named for the multi-stage metric execution. I would like to see test showing what happens when expression names in a metric clash with the expression names in the host query.

src/metabase/query_processor/middleware/metrics.clj Outdated Show resolved Hide resolved
src/metabase/query_processor/middleware/metrics.clj Outdated Show resolved Hide resolved
((requiring-resolve 'metabase.query-processor.preprocess/preprocess)
(lib/query query (:dataset-query card-metadata))))]
{:query metric-query
:aggregation (first (lib/aggregations metric-query))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this fail if there is not exactly one aggregation?

Copy link
Contributor Author

@snoe snoe May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think more than one aggregation should be impossible to build so I think it is safe to assume here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant, if it should throw. Maybe the > 1 case shouldn't, but then it should log, I guess.

src/metabase/query_processor/middleware/metrics.clj Outdated Show resolved Hide resolved
src/metabase/query_processor/middleware/metrics.clj Outdated Show resolved Hide resolved
@snoe snoe requested a review from metamben May 16, 2024 15:40
Copy link
Contributor

@metamben metamben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good, any remaining issues can be addressed in a follow up PR.

@snoe snoe enabled auto-merge (squash) May 16, 2024 22:14
@snoe snoe added the no-backport Do not backport this PR to any branch label May 16, 2024
@snoe snoe merged commit a4e2903 into metrics-v2 May 16, 2024
128 of 133 checks passed
@snoe snoe deleted the metrics-v2-qp-no-joins branch May 16, 2024 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport Do not backport this PR to any branch .Team/QueryProcessor :hammer_and_wrench:
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants