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

fix: show the total row count in the SQL Lab Query History tab when limited by DISPLAY_MAX_ROW #19054

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions superset-frontend/src/SqlLab/components/ResultSet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -583,18 +583,20 @@ export default class ResultSet extends React.PureComponent<
const limitReached = results?.displayLimitReached;
const limit = queryLimit || results.query.limit;
const isAdmin = !!this.props.user?.roles?.Admin;
const rowsCount = Math.min(rows || 0, results?.data?.length || 0);

const displayMaxRowsReachedMessage = {
withAdmin: t(
'The number of results displayed is limited to %(rows)d by the configuration DISPLAY_MAX_ROWS. ' +
'Please add additional limits/filters or download to csv to see more rows up to ' +
'the %(limit)d limit.',
{ rows, limit },
{ rows: rowsCount, limit },
),
withoutAdmin: t(
'The number of results displayed is limited to %(rows)d. ' +
'Please add additional limits/filters, download to csv, or contact an admin ' +
'to see more rows up to the %(limit)d limit.',
{ rows, limit },
{ rows: rowsCount, limit },
),
};
const shouldUseDefaultDropdownAlert =
Expand Down Expand Up @@ -657,7 +659,7 @@ export default class ResultSet extends React.PureComponent<
<Alert
type="warning"
onClose={this.onAlertClose}
message={t('%(rows)d rows returned', { rows })}
message={t('%(rows)d rows returned', { rows: rowsCount })}
description={
isAdmin
? displayMaxRowsReachedMessage.withAdmin
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/SqlLab/reducers/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export default function sqlLabReducer(state = {}, action) {
endDttm: now(),
progress: 100,
results: action.results,
rows: action?.results?.data?.length,
rows: action?.results?.query?.rows || 0,
state: 'success',
limitingFactor: action?.results?.query?.limitingFactor,
tempSchema: action?.results?.query?.tempSchema,
Expand Down