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

Render columns dynamically on wide tables #7693

Merged
merged 8 commits into from
Jun 12, 2019
Merged

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Jun 11, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

With #7625 SQL Lab now displays complex column types as extended columns. This might result in very wide tables that degrade performance when visualizing preview samples or query results.

This PR modifies SQL Lab so that wide tables (greater than 50 columns) are displayed using react-virtualized's Grid instead of a Table. This ensures that columns are loaded dynamically as the user scrolls horizontally. The only downside is that the user is no longer able to sort the data by clicking on a column header.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Here's a demo showing the Grid component with the query table (the table has only 27 columns, but I modified the threshold temporarily in order to test):

grid-view

I also tested with a table with over 300 columns, but I can't share the data.

TEST PLAN

Tested locally (see above). Added unit test.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

This removes the ability of sorting on the client side on tables with more than 50 columns.

REVIEWERS

@mistercrunch @khtruong

@etr2460
Copy link
Member

etr2460 commented Jun 11, 2019

The issue you're solving might be fixed by my PR here: #7690. If you pull that branch, do you still see the degraded performance?

return (
<TooltipWrapper key={key} label="header" tooltip={label}>
<div
style={{ ...style, top: style.top - 4 }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a const above for 4.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, good catch! I'll fix it.

columnCount={orderedColumnKeys.length}
columnWidth={getColumnWidth}
height={rowHeight}
ref={(ref) => { this.container = ref; }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's pull this out into a const so we aren't creating a new function every time. Comment applies elsewhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

+1

@betodealmeida
Copy link
Member Author

@etr2460 that's awesome! I'll take a look.

I have a feeling that we might still need both solutions combined, since this one didn't solve all the performance problems. And our table when rendered has more than 2 millions pixels of width, so your solution might not be enough.

@codecov-io
Copy link

codecov-io commented Jun 12, 2019

Codecov Report

Merging #7693 into master will decrease coverage by 8.16%.
The diff coverage is 90.9%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7693      +/-   ##
==========================================
- Coverage   73.92%   65.76%   -8.17%     
==========================================
  Files         106      459     +353     
  Lines       11444    21914   +10470     
  Branches        0     2408    +2408     
==========================================
+ Hits         8460    14411    +5951     
- Misses       2984     7382    +4398     
- Partials        0      121     +121
Impacted Files Coverage Δ
...src/components/FilterableTable/FilterableTable.jsx 88.42% <90.9%> (ø)
superset/assets/src/components/Checkbox.jsx 100% <0%> (ø)
...ations/deckgl/layers/Polygon/PolygonChartPlugin.js 0% <0%> (ø)
...ets/src/dashboard/components/dnd/DragDroppable.jsx 94.59% <0%> (ø)
...c/visualizations/deckgl/layers/Polygon/Polygon.jsx 0% <0%> (ø)
superset/assets/src/components/EditableTitle.jsx 81.53% <0%> (ø)
superset/assets/src/setup/setupPlugins.js 0% <0%> (ø)
...t/assets/src/components/InfoTooltipWithTrigger.jsx 41.66% <0%> (ø)
.../src/dashboard/components/UndoRedoKeylisteners.jsx 9.52% <0%> (ø)
...ts/src/explore/components/ExploreActionButtons.jsx 100% <0%> (ø)
... and 344 more

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 541db94...9e2da49. Read the comment docs.

@betodealmeida betodealmeida merged commit 5cf0633 into apache:master Jun 12, 2019
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants