Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

feat(core): add support for non-temporal series limit #1356

Merged

Conversation

villebro
Copy link
Contributor

@villebro villebro commented Sep 10, 2021

🏆 Enhancements

Currently it is impossible to restrict the number of series in non-temporal charts. This adds three new QueryForm and QueryObject properties, along with relevant shared controls for them:

  • series_columns: the columns to group by when limiting series (previously always assumed to be all groupby columns except the temporal column). This can be left undefined/[], in which case series limiting won't happen.
  • series_limit: to replace timeseries_limit
  • series_limit_metric: to replace timeseries_limit_metric

As a POC, this functionality is implemented on the BoxPlot chart where this functionality was mostly broken (only working if distribution was across temporal column).

Related PR on apache/superset: apache/superset#16660

AFTER

Here we've defined a non-temporal series limit column countries with a limit of 5 series, and the chart renders correctly with the top 5 regions:
image

BEFORE

Before the x-axis would populate more than the specified 5 series:
image

@villebro villebro requested a review from a team as a code owner September 10, 2021 08:50
@vercel
Copy link

vercel bot commented Sep 10, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/superset/superset-ui/2gx3XZ76mr7RdZb7C12VLrfc3vfr
✅ Preview: https://superset-ui-git-fork-preset-io-villebro-boxplot-a9db7f-superset.vercel.app

@codecov
Copy link

codecov bot commented Sep 10, 2021

Codecov Report

Merging #1356 (3a8397c) into master (8249e92) will increase coverage by 0.01%.
The diff coverage is 44.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1356      +/-   ##
==========================================
+ Coverage   30.03%   30.05%   +0.01%     
==========================================
  Files         489      489              
  Lines        9854     9859       +5     
  Branches     1654     1657       +3     
==========================================
+ Hits         2960     2963       +3     
  Misses       6653     6653              
- Partials      241      243       +2     
Impacted Files Coverage Δ
...ges/superset-ui-core/src/query/buildQueryObject.ts 100.00% <ø> (ø)
.../superset-ui-core/src/query/types/QueryFormData.ts 100.00% <ø> (ø)
...et-ui-chart-controls/src/shared-controls/index.tsx 36.36% <33.33%> (-0.10%) ⬇️
...ins/plugin-chart-echarts/src/BoxPlot/buildQuery.ts 47.05% <50.00%> (+7.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8249e92...3a8397c. Read the comment docs.

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
@villebro villebro changed the title feat(plugin-chart-echarts): add support for non-temporal series limit feat(core): add support for non-temporal series limit Sep 10, 2021
Copy link
Contributor

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

sort by control can't append order by clause in the main-query(outer-query).

Could we make some trade-off, how to do sort in both main-query(outer) and series-limit query(inner)

image

Copy link
Contributor

@ktmud ktmud left a comment

Choose a reason for hiding this comment

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

LGTM

@zhaoyongjie zhaoyongjie self-requested a review September 15, 2021 05:56
Copy link
Contributor

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

LGTM

@villebro
Copy link
Contributor Author

Thanks all for the input and reviews! Looking forward to help make generic x-axis happen!

@villebro villebro merged commit d7533f8 into apache-superset:master Sep 15, 2021
@villebro villebro deleted the villebro/boxplot-series-limit branch September 15, 2021 05:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants