-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Count Field usage #39671
Count Field usage #39671
Conversation
|
* Revert "Remove Models from Browse data (#40108)" This reverts commit 45a2e86. * Make rtl friendly * Add 'no description' for blank-description models * Fix vertical position of collection header toggle * Move FixedSizeIcon into metabase/ui and increase height of empty state * Move FixedSizeIcon back into BrowseModels.styled.tsx * Localize 'No description' * Add comment * Fix type issue
* Trigger the query limit change on blur * Use named export * Add a unit test * Fix E2E tests * Fix unit tests * Additional E2E test fix * Address review comments
Codenotify: Notifying subscribers in CODENOTIFY files for diff 5fb43f2...416e289.
|
src/metabase/query_processor/middleware/process_userland_query.clj
Outdated
Show resolved
Hide resolved
src/metabase/query_processor/middleware/process_userland_query.clj
Outdated
Show resolved
Hide resolved
breakout_binning_num_bins, bin_width, strategy - Remove filter_args as we might need a better way to store those args - no more multimethod, defn all the way
okay so we(w/ Cal) had a huddle and decided that we don't want to store any json in this table of ease of querying in the future. No one like looking into parsing instead we'll now have 3 more columns: breakout_binning_strategy, breakout_binning_bin_width, breakout_binning_num_bin. Also removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, looks good from my perspective. I'd still like someone from QPD to review the MLv2 usage in src/metabase/models/field_usage.clj
, and the changes in metabase.lib
, and metabase.query_processor
though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few miscellany, but the note about misusing the QP middleware is important. Please fix that.
@@ -141,6 +154,12 @@ | |||
:result_rows 0 | |||
:start_time_millis (System/currentTimeMillis)}) | |||
|
|||
(defn- query->field-usages | |||
[query] | |||
(->> (normalize/normalize-preprocessing-middleware query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is misusing the middleware. It's not a helper function intended to be called like this. The middleware runs in a defined order, see metabase.query-processor.preprocess/middleware
for the big list.
In particular, you'll see that normalize/normalize-preprocessing-middleware
is the first step, and fetch-source-query/resolve-source-cards
is near the top. So you shouldn't have to call either of these - the query will be fully preprocessed already.
test/metabase/query_processor/middleware/process_userland_query_test.clj
Outdated
Show resolved
Hide resolved
0672b8a
to
698fa23
Compare
@bshepherdson I've updated so we don't process the query in process-userland-query middleware, instead we get the passed the processed query through metadata and then dissoc it before returning. Please help reviews! |
(let [preprocessed-query (:preprocessed_query metadata) | ||
;; we only need the preprocessed query to find field usages, so make sure we don't return it | ||
result (rff (dissoc metadata :preprocessed_query)) | ||
field-usages (field-usage/pmbql->field-usages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seem to be happening synchronously during query execution, I wonder if there is any sense into passing it somewhere to execute async? Especially if we add parsing SQL in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdym by parsing SQL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well right now it get field usages from mbql queries, right? But not from SQL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, only mbql
…ore coming out of QP
698fa23
to
3b7dd4b
Compare
Closes #40494
Milestone 2 of #38229