Skip to content

Commit

Permalink
Web console: fix result count (#14786)
Browse files Browse the repository at this point in the history
* fix result count

* fixes
  • Loading branch information
vogievetsky authored Aug 9, 2023
1 parent 8f102f9 commit b1988b2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -45,11 +50,17 @@ export const ExecutionSummaryPanel = React.memo(function ExecutionSummaryPanel(

if (queryResult) {
const wrapQueryLimit = queryResult.getSqlOuterLimit();
const hasMoreResults = queryResult.getNumResults() === wrapQueryLimit;
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`
: pluralIfNeeded(queryResult.getNumResults(), 'result');
resultCount = hasMoreResults
? `${formatInteger(queryResult.getNumResults() - 1)}+ results`
: pluralIfNeeded(queryResult.getNumResults(), 'result');
}

const warningCount = execution?.stages?.getWarningCount();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b1988b2

Please sign in to comment.