Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//@flow
import React from "react";
import ReactDOMServer from "react-dom/server";
import * as dagreD3 from "dagre-d3";
import * as d3 from "d3";
import {
formatRows,
getStageStateColor,
initializeGraph,
initializeSvg,
parseAndFormatDataSize,
truncateString
} from "../utils";
import {QueryHeader} from "./QueryHeader";
type StageStatisticsProps = {
stage: any,
}
type StageStatisticsState = {}
type StageNodeInfo = {
stageId: string,
id: string,
root: string,
distribution: any,
stageStats: any,
state: string,
nodes: Map,
}
class StageStatistics extends React.Component {
static getStages(queryInfo): Map {
const stages: Map = new Map();
StageStatistics.flattenStage(queryInfo.outputStage, stages);
return stages;
}
static flattenStage(stageInfo, result) {
stageInfo.subStages.forEach(function (stage) {
StageStatistics.flattenStage(stage, result);
});
const nodes = new Map();
StageStatistics.flattenNode(result, stageInfo.plan.root, JSON.parse(stageInfo.plan.jsonRepresentation), nodes);
result.set(stageInfo.plan.id, {
stageId: stageInfo.stageId,
id: stageInfo.plan.id,
root: stageInfo.plan.root.id,
distribution: stageInfo.plan.distribution,
stageStats: stageInfo.stageStats,
state: stageInfo.state,
nodes: nodes
});
}
static flattenNode(stages, rootNodeInfo, node: any, result: Map) {
result.set(node.id, {
id: node.id,
name: node['name'],
descriptor: node['descriptor'],
details: node['details'],
sources: node.children.map(node => node.id),
});
node.children.forEach(function (child) {
StageStatistics.flattenNode(stages, rootNodeInfo, child, result);
});
}
render() {
const stage = this.props.stage;
const stats = this.props.stage.stageStats;
return (
);
if (this.state.initialized) {
label = "Query not found";
}
return (
{label}
);
}
let loadingMessage = null;
if (query && !query.outputStage) {
loadingMessage = (
Live plan graph will appear automatically when query starts running.
Loading...
)
}
// TODO: Refactor components to move refreshLoop to parent rather than using this property
const queryHeader = this.props.isEmbedded ? null : ;
return (
{queryHeader}
{loadingMessage}
{this.state.ended ? "Scroll to zoom." : "Zoom disabled while query is running." } Click stage to view additional statistics