Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import QueryControlDropdown from "@/components/EditVisualizationButton/QueryCont
import EditVisualizationButton from "@/components/EditVisualizationButton";
import useQueryResultData from "@/lib/useQueryResultData";
import { durationHumanize, pluralize, prettySize } from "@/lib/utils";
import { isUndefined } from "lodash";

import "./QueryExecutionMetadata.less";

Expand Down Expand Up @@ -51,7 +52,8 @@ export default function QueryExecutionMetadata({
"Result truncated to " +
queryResultData.rows.length +
" rows. Databricks may truncate query results that are unstably large."
}>
}
>
<WarningTwoTone twoToneColor="#FF9800" />
</Tooltip>
</span>
Expand All @@ -67,10 +69,9 @@ export default function QueryExecutionMetadata({
)}
{isQueryExecuting && <span>Running&hellip;</span>}
</span>
{queryResultData.metadata.data_scanned && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the reason for having this conditional is to prevent showing "Data scanned" for data sources that don't support it, which is actually most data sources Redash supports.

How about we change this conditional to something like:

isDefined(queryResultData.metadata.data_scanned) && 

Instead of just assuming it's a boolean? This way if it's a zero it will show and if it wasn't defined, it will be ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when query is executing, you'd still see

354339802-a30be3ce-c1ab-474d-97b2-132a2b74fa99
and
354339839-bf471cc5-4d42-4039-ba23-476cf48011bc

because it is defined, and it's 0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's defined and it's 0, with the updated version it will show "Data Scanned 0 bytes", no? Kind of same behavior as you would see with your suggested change, but only for data sources that actually define data_scanned.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is what i tried (couldn't find a isDefined so i used !isUndefined)

import {isUndefined} from "lodash";

{!isUndefined(queryResultData.metadata.data_scanned) && (
  <span className="m-l-5">
    Data Scanned <strong>{prettySize(queryResultData.metadata.data_scanned)}</strong>
  </span>
)}

the answer is yes and no, there are 2 states here

  1. when query execution is done, you do see the correct message 244 rows 8 seconds runtime Data Scanned 0 bytes
  2. when query is still executing, you'll see 244 rows Running… Data Scanned 0 bytes which is a bit confusing because the query is still running

but i do see your point, with only the !isQueryExecuting, when "Data scanned" is not supported, we are seeing 3 rows 4 seconds runtimeData Scanned ?

so i think we should do both

!isUndefined(queryResultData.metadata.data_scanned) && !isQueryExecuting

{!isUndefined(queryResultData.metadata.data_scanned) && !isQueryExecuting && (
<span className="m-l-5">
Data Scanned
<strong>{prettySize(queryResultData.metadata.data_scanned)}</strong>
Data Scanned <strong>{prettySize(queryResultData.metadata.data_scanned)}</strong>
</span>
)}
</span>
Expand Down
Loading