From b1988b2f93d243e2685718a7d910fda2495a9bbd Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Wed, 9 Aug 2023 08:03:01 -0700 Subject: [PATCH] Web console: fix result count (#14786) * fix result count * fixes --- .../execution-summary-panel.tsx | 21 ++++++++++++++----- .../workbench-view/run-panel/run-panel.tsx | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/web-console/src/views/workbench-view/execution-summary-panel/execution-summary-panel.tsx b/web-console/src/views/workbench-view/execution-summary-panel/execution-summary-panel.tsx index bdeb738196d..9d1030133b2 100644 --- a/web-console/src/views/workbench-view/execution-summary-panel/execution-summary-panel.tsx +++ b/web-console/src/views/workbench-view/execution-summary-panel/execution-summary-panel.tsx @@ -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(); - 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(); diff --git a/web-console/src/views/workbench-view/run-panel/run-panel.tsx b/web-console/src/views/workbench-view/run-panel/run-panel.tsx index 07b915332db..c196cfc21e6 100644 --- a/web-console/src/views/workbench-view/run-panel/run-panel.tsx +++ b/web-console/src/views/workbench-view/run-panel/run-panel.tsx @@ -347,7 +347,7 @@ export const RunPanel = React.memo(function RunPanel(props: RunPanelProps) { ))}