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

feat(sqllab): Dynamic query limit dropdown #25855

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

giftig
Copy link
Contributor

@giftig giftig commented Nov 3, 2023

SUMMARY

Previously, this was a constant of powers of ten from 10 to 100000 and then we tacked on maxRow on the end, being the SQL_MAX_ROW config. This unfortunately results is very confusing behaviour if SQL_MAX_ROW is less than 100,000 as it still let you select 100,000, though wouldn't acctually use that LIMIT, and the messaging would not acknowledge the setting for SQL_MAX_ROW either.

Instead, construct the list by ascending through powers of ten until we reach the configured SQL_MAX_ROW.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

BEFORE-static

After

AFTER-dynamic

TESTING INSTRUCTIONS

  1. Set SQL_MAX_ROW to a value less than 100,000 or greater than 1,000,000
  2. Use the LIMIT dropdown in SQL Lab
  3. Observe that the drop down no longer displays values higher than SQL_MAX_ROW, and will display every power of 10 up to SQL_MAX_ROW

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@giftig
Copy link
Contributor Author

giftig commented Nov 3, 2023

Tagging @justinpark since I see you were the author of this file.

const dropdown = baseElement.getElementsByClassName(
'ant-dropdown-trigger',
)[0];

userEvent.click(dropdown);
await waitFor(() => expect(getByRole('menu')).toBeInTheDocument());

const expectedLabels = [10, 100, 1000, 10000, 50000].map(i =>
Copy link
Member

@john-bodley john-bodley Nov 3, 2023

Choose a reason for hiding this comment

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

@giftig would you also mind adding a couple of tests: i) when maxRow is a factor of 10, and ii) when the maxRow is less than 10?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

Previously, this was a constant of powers of ten from 10 to 100000 and
then we tacked on maxRow on the end, being the SQL_MAX_ROW config. This
unfortunately results is very confusing behaviour if SQL_MAX_ROW is less
than 100,000 as it still let you select 100,000, though wouldn't
acctually use that LIMIT, and the messaging would not acknowledge the
setting for SQL_MAX_ROW either.

Instead, construct the list by ascending through powers of ten until we
reach the configured SQL_MAX_ROW.
@john-bodley john-bodley merged commit fb35bac into apache:master Nov 6, 2023
26 checks passed
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 22, 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/M 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants