diff --git a/presto-ui/src/components/QueryDetail.jsx b/presto-ui/src/components/QueryDetail.jsx index 36687ba82286b..b9067692edb12 100644 --- a/presto-ui/src/components/QueryDetail.jsx +++ b/presto-ui/src/components/QueryDetail.jsx @@ -12,7 +12,7 @@ * limitations under the License. */ -import React from "react"; +import {useState, useEffect, useRef} from "react"; import DataTable, {createTheme} from 'react-data-table-component'; import { @@ -349,29 +349,22 @@ const HISTOGRAM_PROPERTIES = { disableHiddenCheck: true, }; -class RuntimeStatsList extends React.Component { - constructor(props) { - super(props); - this.state = { - expanded: false - }; - } +const RuntimeStatsList = ({ stats }) => { + const [expanded, setExpanded] = useState(false); - getExpandedIcon() { - return this.state.expanded ? "bi bi-chevron-up" : "bi bi-chevron-down"; - } + const getExpandedIcon = () => { + return expanded ? "bi bi-chevron-up" : "bi bi-chevron-down"; + }; - getExpandedStyle() { - return this.state.expanded ? {} : {display: "none"}; - } + const getExpandedStyle = () => { + return expanded ? {} : {display: "none"}; + }; - toggleExpanded() { - this.setState({ - expanded: !this.state.expanded, - }) - } + const toggleExpanded = () => { + setExpanded(!expanded); + }; - renderMetricValue(unit, value) { + const renderMetricValue = (unit, value) => { if (unit === "NANO") { return formatDuration(parseDuration(value + "ns")); } @@ -379,69 +372,52 @@ class RuntimeStatsList extends React.Component { return formatDataSize(value); } return formatCount(value); // NONE - } - - render() { - return ( -
| Metric Name | -Sum | -Count | -Min | -Max | -- - - - | -
|---|---|---|---|---|---|
| {metric.name} | -{this.renderMetricValue(metric.unit, metric.sum)} | -{formatCount(metric.count)} | -{this.renderMetricValue(metric.unit, metric.min)} | -{this.renderMetricValue(metric.unit, metric.max)} | -
| Metric Name | +Sum | +Count | +Min | +Max | ++ + + + | +
|---|---|---|---|---|---|
| {metric.name} | +{renderMetricValue(metric.unit, metric.sum)} | +{formatCount(metric.count)} | +{renderMetricValue(metric.unit, metric.min)} | +{renderMetricValue(metric.unit, metric.max)} | +
|
-
-
-
-
|
-
|
+
+
+
+
|
+
|
+ {stageId}
+ |
+
+
|
- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- {QueryDetail.formatStackTrace(query.failureInfo)}
+ {formatStackTrace(query.failureInfo)}
| - User - | -- {query.session.user} - - - - - | -
| - Principal - | -- {query.session.principal} - | -
| - Source - | -- {query.session.source} - | -
| - Catalog - | -- {query.session.catalog} - | -
| - Schema - | -- {query.session.schema} - | -
| - Client Address - | -- {query.session.remoteUserAddress} - | -
| - Client Tags - | -- {query.session.clientTags.join(", ")} - | -
| - Session Properties - | -- {this.renderSessionProperties()} - | -
| - Resource Estimates - | -- {this.renderResourceEstimates()} - | -
| - Resource Group - | -- {query.resourceGroupId ? query.resourceGroupId.join(".") : "n/a"} - | -
| - Submission Time - | -- {formatShortDateTime(new Date(query.queryStats.createTime))} - | -
| - Completion Time - | -- {new Date(query.queryStats.endTime).getTime() !== 0 ? formatShortDateTime(new Date(query.queryStats.endTime)) : ""} - | -
| - Elapsed Time - | -- {query.queryStats.elapsedTime} - | -
| - Prerequisites Wait Time - | -- {query.queryStats.waitingForPrerequisitesTime} - | -
| - Queued Time - | -- {query.queryStats.queuedTime} - | -
| - Planning Time - | -- {query.queryStats.totalPlanningTime} - | -
| - Execution Time - | -- {query.queryStats.executionTime} - | -
| - Coordinator - | -- {getHostname(query.self)} - | -
| + User + | ++ {query.session.user} + + + + + | +
| + Principal + | ++ {query.session.principal} + | +
| + Source + | ++ {query.session.source} + | +
| + Catalog + | ++ {query.session.catalog} + | +
| + Schema + | ++ {query.session.schema} + | +
| + Client Address + | ++ {query.session.remoteUserAddress} + | +
| + Client Tags + | ++ {query.session.clientTags.join(", ")} + | +
| + Session Properties + | ++ {renderSessionProperties()} + | +
| + Resource Estimates + | ++ {renderResourceEstimates()} + | +
| - CPU Time - | -- {query.queryStats.totalCpuTime} - | -
| - Scheduled Time - | -- {query.queryStats.totalScheduledTime} - | -
| - Blocked Time - | -- {query.queryStats.totalBlockedTime} - | -
| - Input Rows - | -- {formatCount(query.queryStats.processedInputPositions)} - | -
| - Input Data - | -- {query.queryStats.processedInputDataSize} - | -
| - Raw Input Rows - | -- {formatCount(query.queryStats.rawInputPositions)} - | -
| - Raw Input Data - | -- {query.queryStats.rawInputDataSize} - | -
| - - Shuffled Rows - - | -- {formatCount(query.queryStats.shuffledPositions)} - | -
| - - Shuffled Data - - | -- {query.queryStats.shuffledDataSize} - | -
| - Peak User Memory - | -- {query.queryStats.peakUserMemoryReservation} - | -
| - Peak Total Memory - | -- {query.queryStats.peakTotalMemoryReservation} - | -
| - Memory Pool - | -- {query.memoryPool} - | -
| - Cumulative User Memory - | -- {formatDataSize(query.queryStats.cumulativeUserMemory / 1000.0)} - | -
| - Cumulative Total - | -- {formatDataSize(query.queryStats.cumulativeTotalMemory / 1000.0)} - | -
| - Output Rows - | -- {formatCount(query.queryStats.outputPositions)} - | -
| - Output Data - | -- {query.queryStats.outputDataSize} - | -
| - Written Output Rows - | -- {formatCount(query.queryStats.writtenOutputPositions)} - | -
| - Written Output Logical Data Size - | -- {query.queryStats.writtenOutputLogicalDataSize} - | -
| + Resource Group + | ++ {query.resourceGroupId ? query.resourceGroupId.join(".") : "n/a"} + | +
| + Submission Time + | ++ {formatShortDateTime(new Date(query.queryStats.createTime))} + | +
| + Completion Time + | ++ {new Date(query.queryStats.endTime).getTime() !== 0 ? formatShortDateTime(new Date(query.queryStats.endTime)) : ""} + | +
| + Elapsed Time + | ++ {query.queryStats.elapsedTime} + | +
| + Prerequisites Wait Time + | ++ {query.queryStats.waitingForPrerequisitesTime} + | +
| + Queued Time + | ++ {query.queryStats.queuedTime} + | +
| + Planning Time + | ++ {query.queryStats.totalPlanningTime} + | +
| + Execution Time + | ++ {query.queryStats.executionTime} + | +
| + Coordinator + | ++ {getHostname(query.self)} + | +
| + CPU Time + | ++ {query.queryStats.totalCpuTime} + | +
| + Scheduled Time + | ++ {query.queryStats.totalScheduledTime} + | +
| + Blocked Time + | ++ {query.queryStats.totalBlockedTime} + | +
| + Input Rows + | ++ {formatCount(query.queryStats.processedInputPositions)} + | +
| + Input Data + | ++ {query.queryStats.processedInputDataSize} + | +
| + Raw Input Rows + | ++ {formatCount(query.queryStats.rawInputPositions)} + | +
| + Raw Input Data + | ++ {query.queryStats.rawInputDataSize} + | +
| + + Shuffled Rows + + | ++ {formatCount(query.queryStats.shuffledPositions)} + | +
| + + Shuffled Data + + | ++ {query.queryStats.shuffledDataSize} + | +
| + Peak User Memory + | ++ {query.queryStats.peakUserMemoryReservation} + | +
| + Peak Total Memory + | ++ {query.queryStats.peakTotalMemoryReservation} + | +
| + Memory Pool + | ++ {query.memoryPool} + | +
| + Cumulative User Memory + | ++ {formatDataSize(query.queryStats.cumulativeUserMemory / 1000.0)} + | +
| + Cumulative Total + | ++ {formatDataSize(query.queryStats.cumulativeTotalMemory / 1000.0)} + | +
| + Output Rows + | ++ {formatCount(query.queryStats.outputPositions)} + | +
| + Output Data + | ++ {query.queryStats.outputDataSize} + | +
| + Written Output Rows + | ++ {formatCount(query.queryStats.writtenOutputPositions)} + | +
| + Written Output Logical Data Size + | ++ {query.queryStats.writtenOutputLogicalDataSize} + | +
| + Written Output Physical Data Size + | ++ {query.queryStats.writtenOutputPhysicalDataSize} + | +
| - Written Output Physical Data Size + Spilled Data | - {query.queryStats.writtenOutputPhysicalDataSize} - | -
| - Spilled Data - | -- {query.queryStats.spilledDataSize} - | -
| - Parallelism - | -
-
-
+ {query.queryStats.spilledDataSize}
Loading ...
- |
| - {formatCount(this.state.cpuTimeRate[this.state.cpuTimeRate.length - 1])} - | -|
| - Scheduled Time/s - | -
-
-
- Loading ...
- |
-
| - {formatCount(this.state.scheduledTimeRate[this.state.scheduledTimeRate.length - 1])} - | -|
| - Input Rows/s - | -
-
-
- Loading ...
- |
-
| - {formatCount(this.state.rowInputRate[this.state.rowInputRate.length - 1])} - | -|
| - Input Bytes/s - | -
-
-
- Loading ...
- |
-
| - {formatDataSize(this.state.byteInputRate[this.state.byteInputRate.length - 1])} - | -|
| - Memory Utilization - | -
-
-
- Loading ...
- |
-
| - {formatDataSize(this.state.reservedMemory[this.state.reservedMemory.length - 1])} - | -
| + Parallelism + | +
+
+
+ Loading ...
+ |
+
| + {formatCount(state.cpuTimeRate[state.cpuTimeRate.length - 1])} + | +|
| + Scheduled Time/s + | +
+
+
+ Loading ...
+ |
+
| + {formatCount(state.scheduledTimeRate[state.scheduledTimeRate.length - 1])} + | +|
| + Input Rows/s + | +
+
+
+ Loading ...
+ |
+
| + {formatCount(state.rowInputRate[state.rowInputRate.length - 1])} + | +|
| + Input Bytes/s + | +
+
+
+ Loading ...
+ |
+
| + {formatDataSize(state.byteInputRate[state.byteInputRate.length - 1])} + | +|
| + Memory Utilization + | +
+
+
+ Loading ...
+ |
+
| + {formatDataSize(state.reservedMemory[state.reservedMemory.length - 1])} + | +
-
- {query.query}
-
-
-
+
+ {query.query}
+
+
{QueryListItem.stripQueryTextWhitespace(query.query, query.queryTruncated)}
- {stripQueryTextWhitespace(query.query, query.queryTruncated)}