Skip to content

Commit

Permalink
feat: Configurable default row limit for native filters (apache#24043)
Browse files Browse the repository at this point in the history
Co-authored-by: Calum Leslie <[email protected]>
  • Loading branch information
cleslie and Calum Leslie authored Jun 12, 2023
1 parent cd78ccb commit 6f25275
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ import extractUrlParams from 'src/dashboard/util/extractUrlParams';
import { isFeatureEnabled } from 'src/featureFlags';
import { CHART_TYPE, TAB_TYPE } from '../../util/componentTypes';
import { DASHBOARD_GRID_ID, DASHBOARD_ROOT_ID } from '../../util/constants';
import getBootstrapData from '../../../utils/getBootstrapData';

const getDefaultRowLimit = (): number => {
const bootstrapData = getBootstrapData();
const nativeFilterDefaultRowLimit =
bootstrapData?.common?.conf?.NATIVE_FILTER_DEFAULT_ROW_LIMIT;
return nativeFilterDefaultRowLimit || 1000;
};

export const getFormData = ({
datasetId,
Expand Down Expand Up @@ -75,7 +83,7 @@ export const getFormData = ({
extra_form_data: dependencies,
granularity_sqla,
metrics: ['count'],
row_limit: 1000,
row_limit: getDefaultRowLimit(),
showSearch: true,
defaultValue: defaultDataMask?.filterState?.value,
time_range,
Expand Down
2 changes: 2 additions & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def _try_json_readsha(filepath: str, length: int) -> str | None:
ROW_LIMIT = 50000
# default row limit when requesting samples from datasource in explore view
SAMPLES_ROW_LIMIT = 1000
# default row limit for native filters
NATIVE_FILTER_DEFAULT_ROW_LIMIT = 1000
# max rows retrieved by filter select auto complete
FILTER_SELECT_ROW_LIMIT = 10000
# default time filter in explore
Expand Down
1 change: 1 addition & 0 deletions superset/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"ALERT_REPORTS_DEFAULT_CRON_VALUE",
"ALERT_REPORTS_DEFAULT_RETENTION",
"ALERT_REPORTS_DEFAULT_WORKING_TIMEOUT",
"NATIVE_FILTER_DEFAULT_ROW_LIMIT",
)

logger = logging.getLogger(__name__)
Expand Down

0 comments on commit 6f25275

Please sign in to comment.