Web console: fix result count (#14786)

* fix result count

* fixes
This commit is contained in:
Vadim Ogievetsky 2023-08-09 08:03:01 -07:00 committed by GitHub
parent 8f102f9031
commit b1988b2f93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 6 deletions

View File

@ -23,7 +23,12 @@ import type { JSX } from 'react';
import React, { useState } from 'react';
import type { Execution } from '../../../druid-models';
import { downloadQueryResults, formatDurationHybrid, pluralIfNeeded } from '../../../utils';
import {
downloadQueryResults,
formatDurationHybrid,
formatInteger,
pluralIfNeeded,
} from '../../../utils';
import { DestinationPagesDialog } from '../destination-pages-dialog/destination-pages-dialog';
import './execution-summary-panel.scss';
@ -45,11 +50,17 @@ export const ExecutionSummaryPanel = React.memo(function ExecutionSummaryPanel(
if (queryResult) {
const wrapQueryLimit = queryResult.getSqlOuterLimit();
let resultCount: string;
const numTotalRows = execution?.destination?.numTotalRows;
if (typeof wrapQueryLimit === 'undefined' && typeof numTotalRows === 'number') {
resultCount = pluralIfNeeded(numTotalRows, 'result');
} else {
const hasMoreResults = queryResult.getNumResults() === wrapQueryLimit;
const resultCount = hasMoreResults
? `${queryResult.getNumResults() - 1}+ results`
resultCount = hasMoreResults
? `${formatInteger(queryResult.getNumResults() - 1)}+ results`
: pluralIfNeeded(queryResult.getNumResults(), 'result');
}
const warningCount = execution?.stages?.getWarningCount();

View File

@ -347,7 +347,7 @@ export const RunPanel = React.memo(function RunPanel(props: RunPanelProps) {
))}
<MenuDivider />
<MenuCheckbox
checked={selectDestination === 'taskReport' ? !query.unlimited : undefined}
checked={selectDestination === 'taskReport' ? !query.unlimited : false}
intent={intent}
disabled={selectDestination !== 'taskReport'}
text="Limit SELECT results in taskReport"