-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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(explore): default aggregate for string/numeric columns when creating metric #15798
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15798 +/- ##
==========================================
- Coverage 76.91% 76.90% -0.02%
==========================================
Files 984 984
Lines 51705 51718 +13
Branches 6994 7000 +6
==========================================
+ Hits 39770 39774 +4
- Misses 11711 11720 +9
Partials 224 224
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
To fill up pre-aggregate function code look good to me. the bug fix we should take more effect. When two metrics have the same name, I can't change one of the name. duplicate.metric.mp4 |
Fixed, thanks for reporting! Can you take another look and verify? |
componentDidUpdate( | ||
prevProps: Readonly<AdhocMetricPopoverTriggerProps>, | ||
prevState: Readonly<AdhocMetricPopoverTriggerState>, | ||
snapshot?: any, | ||
) { |
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.
componentDidUpdate( | |
prevProps: Readonly<AdhocMetricPopoverTriggerProps>, | |
prevState: Readonly<AdhocMetricPopoverTriggerState>, | |
snapshot?: any, | |
) { | |
componentDidUpdate(prevProps: Readonly<AdhocMetricPopoverTriggerProps>) { |
Is not the case for getDerivedStateFromProps?
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.
Good point, I changed that. That required saving adhocMetric in state though, so that I could compare previous and next in getDerviedStateFromProps. Can you take another look?
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.
The code looks great to me.
I'll merge once @junlincc gives a green light - we need to decide if we need a feature flag and if we should replace |
LGTM. let's put the change behind an umbrella feature flag, e.g. UX_beta and set it to false by default. |
/testenv up FEATURE_ENABLE_EXPLORE_DRAG_AND_DROP=true |
@kgabryje Ephemeral environment spinning up at http://52.33.234.64:8080. Credentials are |
"I don’t recommend doing count_distinct for string column. This is a precise deduplication operation. It is very resource intensive for the database. imagine, if this column has many values(high cardinality), this query can easily crash the database. some databases have special functions to do this calculation." @zhaoyongjie I dont think this should be a concern. Even there's a preselected aggregate, users still need to click SAVE and RUN to run query that potentially crush anything. From UX standpoint, having a preselected aggregate has the equal amount of clicks to no preselected if users need to choose COUNT instead. and for most cases, count_distinct is indeed what users choose for STRING columns. I don't see any reasons why we should use COUNT as preselected. |
bc58df4
to
6179aed
Compare
@junlincc I added a |
Ephemeral environment shutdown and build artifacts deleted. |
…ting metric (apache#15798) * feat(explore): default aggregate for string/numeric columns when creating metric * Fix for editing items with the same label * Replace componentDidUpdate with getDerivedStateFromProps * Wrap changes in feature flag
…ting metric (apache#15798) * feat(explore): default aggregate for string/numeric columns when creating metric * Fix for editing items with the same label * Replace componentDidUpdate with getDerivedStateFromProps * Wrap changes in feature flag
…ting metric (apache#15798) * feat(explore): default aggregate for string/numeric columns when creating metric * Fix for editing items with the same label * Replace componentDidUpdate with getDerivedStateFromProps * Wrap changes in feature flag
SUMMARY
When user creates a new adhoc metric with drag and dropping a column into metrics control, auto fill default aggregate in metric popover.
If column's generic type is numeric, set
SUM
aggregate as default.if column's generic type is string or boolean, set
COUNT_DISTINCT
aggregate as default.Otherwise, don't set a default aggregate.
Also, this PR fixes a bug metrics popover - when user created a metric with a custom label and then tried to create next metric, previous label was set instead of a default label. Now it should work as expected.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Screen.Recording.2021-07-20.at.14.06.18.mov
TESTING INSTRUCTIONS
ENABLE_EXPLORE_DRAG_AND_DROP
andUX_BETA
feature flags to TrueSUM
COUNT_DISTINCT
ADDITIONAL INFORMATION
CC @junlincc