sparkforensics-server 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/assets/{AutoscalingChurn-Bf5TN-s_.js → AutoscalingChurn-BOiUUfuY.js} +1 -1
- package/public/assets/{CacheUtilization-DRf_FNrK.js → CacheUtilization-DwX7lisd.js} +1 -1
- package/public/assets/{CachingOpportunity-BTJzIhtI.js → CachingOpportunity-DUE3GKpx.js} +1 -1
- package/public/assets/{ColdStart-DnFgnD3n.js → ColdStart-ZHxPrJmI.js} +1 -1
- package/public/assets/{ConfigAudit-B5FsOdmu.js → ConfigAudit-BkVnq2XE.js} +1 -1
- package/public/assets/{CoreUsageArea-CTksBPuq.js → CoreUsageArea-DobrSXk2.js} +1 -1
- package/public/assets/{Dashboard-BFMsMuc_.js → Dashboard-y3_9iQJo.js} +1 -1
- package/public/assets/{DuplicatePlanSubtree-BCt-Guuh.js → DuplicatePlanSubtree-BSQZFeNq.js} +1 -1
- package/public/assets/{DurationHistogram-xRcnND4k.js → DurationHistogram-DlQv4ZCB.js} +1 -1
- package/public/assets/{EmptyState-CnTrSjtU.js → EmptyState-DqnSxTjJ.js} +1 -1
- package/public/assets/{ExecutorUtilization-CP21XlUq.js → ExecutorUtilization-CuQUxaCd.js} +1 -1
- package/public/assets/{GcPressure-BoEJsLjb.js → GcPressure-CLT5hkMJ.js} +1 -1
- package/public/assets/{ImpactEstimate-BHcqJkcZ.js → ImpactEstimate-Df_laG-n.js} +1 -1
- package/public/assets/{IncompleteRun-b9FWrOHn.js → IncompleteRun-CpIkS4XZ.js} +1 -1
- package/public/assets/{JobFailures-C5FkTq3O.js → JobFailures-DKbvYc4J.js} +1 -1
- package/public/assets/{MemoryUtilization-D2W4AB_f.js → MemoryUtilization-C5kHmXIb.js} +1 -1
- package/public/assets/{OverBroadcast-Btu3xorf.js → OverBroadcast-C5pF66aq.js} +1 -1
- package/public/assets/{PartitionSizing-yZWhLN0e.js → PartitionSizing-BvEJQ5M1.js} +1 -1
- package/public/assets/{PlanExplorer-DSk1ivS4.js → PlanExplorer-DjGTZifP.js} +1 -1
- package/public/assets/{PlanGraphRoute-C3iOzUdB.js → PlanGraphRoute-DoIGA7_H.js} +1 -1
- package/public/assets/{RetryWaste-B4436kr1.js → RetryWaste-C0znHd_w.js} +1 -1
- package/public/assets/{RowPagination-oeWB8gBm.js → RowPagination-2icPidMP.js} +1 -1
- package/public/assets/{ShuffleIO-DUiv8EJe.js → ShuffleIO-L_XSnJ_V.js} +1 -1
- package/public/assets/{Skew-D2lB1oQc.js → Skew-w4uV5H_g.js} +1 -1
- package/public/assets/{SlowHost-Qb_8aa-W.js → SlowHost-D5tWJ1UR.js} +1 -1
- package/public/assets/{SmallFiles-u6suTgfj.js → SmallFiles-CTtNiSOh.js} +1 -1
- package/public/assets/{SpeculationWaste-vUCniiFP.js → SpeculationWaste-xCKwjz2K.js} +1 -1
- package/public/assets/{Spill-BskXFX2e.js → Spill-BT8my24K.js} +1 -1
- package/public/assets/{StageFailed-D9b83Jvy.js → StageFailed-De3vVDbc.js} +1 -1
- package/public/assets/{StageFindingGroup-DagqHOUz.js → StageFindingGroup-R4OW-g4U.js} +1 -1
- package/public/assets/{StageHeader-DibMSunO.js → StageHeader-CGeWqC-0.js} +1 -1
- package/public/assets/{StagePill-Dt6V9yVw.js → StagePill-BwwKLcFl.js} +1 -1
- package/public/assets/{StageShape-CfdrDUZa.js → StageShape-D4LmPVyV.js} +1 -1
- package/public/assets/{StageSlowness-BoGLIYKR.js → StageSlowness-8-z6qn4Q.js} +1 -1
- package/public/assets/{Straggler-DU1WSU-m.js → Straggler-BIgxsowI.js} +1 -1
- package/public/assets/{TaskFailures-DkY6zBNJ.js → TaskFailures-B9lLt6Rw.js} +1 -1
- package/public/assets/{TinyTask-Lsnt5mJF.js → TinyTask-DYXks5sT.js} +1 -1
- package/public/assets/{UnderBroadcast-DxHc0lwy.js → UnderBroadcast-BWqWMpeG.js} +1 -1
- package/public/assets/{finding-anchor-Bl1hRK5E.js → finding-anchor-CDbHtqKT.js} +1 -1
- package/public/assets/{inbox-DHIFHqcn.js → inbox-M_EuWNiK.js} +1 -1
- package/public/assets/{index-U654cmB8.js → index-pnImGbgQ.js} +3 -3
- package/public/assets/{parser-worker-5a9aUx3o.js → parser-worker-C3BAO6z9.js} +4 -2
- package/public/assets/{select-CtKaJ5Hx.js → select-C-MZGNpb.js} +1 -1
- package/public/assets/{toggle-group-DB2VfFIx.js → toggle-group-C3nz7UQ_.js} +1 -1
- package/public/assets/{useRecentFiles-BiYdWs8J.js → useRecentFiles-0XuhS91q.js} +4 -4
- package/public/assets/{useSortMode-BhPky1lW.js → useSortMode-DHlKZeWv.js} +1 -1
- package/public/assets/zstd-worker-C1Jq9lfb.js +1 -0
- package/public/docs/404.html +2 -2
- package/public/docs/assets/{app.BczRxXPr.js → app.DsFQcynM.js} +1 -1
- package/public/docs/assets/chunks/@localSearchIndexroot.BEfYag5Q.js +1 -0
- package/public/docs/assets/chunks/{VPLocalSearchBox.DXvkTVnC.js → VPLocalSearchBox.oa8NbaiV.js} +1 -1
- package/public/docs/assets/chunks/{theme.ByUdwrLG.js → theme.Ca4dR9dL.js} +2 -2
- package/public/docs/assets/{contributor-guide_architecture_detector-contract.md.B1vUqtry.js → contributor-guide_architecture_detector-contract.md.aQQfP7pj.js} +1 -1
- package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.sf9DU2bA.js +1 -0
- package/public/docs/assets/{contributor-guide_architecture_impact-estimation.md.DHVq1UPt.lean.js → contributor-guide_architecture_impact-estimation.md.sf9DU2bA.lean.js} +1 -1
- package/public/docs/assets/contributor-guide_architecture_overview.md.BXQdgG5u.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_overview.md.BXQdgG5u.lean.js +1 -0
- package/public/docs/assets/{contributor-guide_architecture_worker-protocol.md.C0SovZX8.js → contributor-guide_architecture_worker-protocol.md.P7d1vtEJ.js} +2 -2
- package/public/docs/assets/{contributor-guide_architecture_worker-protocol.md.C0SovZX8.lean.js → contributor-guide_architecture_worker-protocol.md.P7d1vtEJ.lean.js} +1 -1
- package/public/docs/assets/contributor-guide_testing.md.BU6vyA-9.js +1 -0
- package/public/docs/assets/contributor-guide_testing.md.BU6vyA-9.lean.js +1 -0
- package/public/docs/contributor-guide/architecture/board-widgets.html +3 -3
- package/public/docs/contributor-guide/architecture/detector-contract.html +5 -5
- package/public/docs/contributor-guide/architecture/drill-down.html +3 -3
- package/public/docs/contributor-guide/architecture/impact-estimation.html +5 -5
- package/public/docs/contributor-guide/architecture/index.html +3 -3
- package/public/docs/contributor-guide/architecture/overview.html +5 -5
- package/public/docs/contributor-guide/architecture/state-and-history.html +3 -3
- package/public/docs/contributor-guide/architecture/widget-rendering.html +3 -3
- package/public/docs/contributor-guide/architecture/worker-protocol.html +5 -5
- package/public/docs/contributor-guide/contributing.html +3 -3
- package/public/docs/contributor-guide/development-setup.html +3 -3
- package/public/docs/contributor-guide/testing.html +5 -5
- package/public/docs/hashmap.json +1 -1
- package/public/docs/index.html +3 -3
- package/public/docs/tuning-reference/anti-patterns.html +3 -3
- package/public/docs/tuning-reference/aqe.html +3 -3
- package/public/docs/tuning-reference/bottleneck-broadcast-sizing.html +3 -3
- package/public/docs/tuning-reference/bottleneck-cold-start.html +3 -3
- package/public/docs/tuning-reference/bottleneck-duplicate-plan-subtree.html +3 -3
- package/public/docs/tuning-reference/bottleneck-failures.html +3 -3
- package/public/docs/tuning-reference/bottleneck-gc.html +3 -3
- package/public/docs/tuning-reference/bottleneck-job-failure-rate.html +3 -3
- package/public/docs/tuning-reference/bottleneck-memory-utilization.html +3 -3
- package/public/docs/tuning-reference/bottleneck-retry-waste.html +3 -3
- package/public/docs/tuning-reference/bottleneck-shuffle.html +3 -3
- package/public/docs/tuning-reference/bottleneck-skew.html +3 -3
- package/public/docs/tuning-reference/bottleneck-slow-host.html +3 -3
- package/public/docs/tuning-reference/bottleneck-small-files.html +3 -3
- package/public/docs/tuning-reference/bottleneck-spill.html +3 -3
- package/public/docs/tuning-reference/bottleneck-straggler.html +3 -3
- package/public/docs/tuning-reference/bottleneck-tiny-tasks.html +3 -3
- package/public/docs/tuning-reference/bottleneck-utilization.html +3 -3
- package/public/docs/tuning-reference/caching.html +3 -3
- package/public/docs/tuning-reference/cluster-config.html +3 -3
- package/public/docs/tuning-reference/config.html +3 -3
- package/public/docs/tuning-reference/data-formats.html +3 -3
- package/public/docs/tuning-reference/index.html +3 -3
- package/public/docs/tuning-reference/intro.html +3 -3
- package/public/docs/tuning-reference/joins.html +3 -3
- package/public/docs/tuning-reference/memory-model.html +3 -3
- package/public/docs/tuning-reference/metrics.html +3 -3
- package/public/docs/tuning-reference/partitioning.html +3 -3
- package/public/docs/tuning-reference/pyspark.html +3 -3
- package/public/docs/tuning-reference/shuffle.html +3 -3
- package/public/docs/tuning-reference/spark-architecture.html +3 -3
- package/public/docs/tuning-reference/table-formats.html +3 -3
- package/public/docs/user-guide/alternative-log-retrieval.html +3 -3
- package/public/docs/user-guide/getting-started.html +3 -3
- package/public/docs/user-guide/mcp-tools.html +3 -3
- package/public/docs/user-guide/run-comparison.html +3 -3
- package/public/docs/user-guide/understanding-findings.html +3 -3
- package/public/index.html +1 -1
- package/vendor-core/impact-estimator.js +23 -3
- package/vendor-core/occupancy.js +8 -7
- package/vendor-core/parser-worker.js +31 -15
- package/vendor-core/plan-summary.js +1 -1
- package/vendor-core/stage-quantiles.js +53 -1
- package/vendor-core/types.js +5 -0
- package/vendor-core/zstd-worker-client.js +180 -0
- package/vendor-core/zstd-worker.js +103 -0
- package/public/docs/assets/chunks/@localSearchIndexroot.c2HfrwDg.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DHVq1UPt.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_overview.md.DkXdJ9jE.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_overview.md.DkXdJ9jE.lean.js +0 -1
- package/public/docs/assets/contributor-guide_testing.md.BohuQWvl.js +0 -1
- package/public/docs/assets/contributor-guide_testing.md.BohuQWvl.lean.js +0 -1
- /package/public/docs/assets/{contributor-guide_architecture_detector-contract.md.B1vUqtry.lean.js → contributor-guide_architecture_detector-contract.md.aQQfP7pj.lean.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-0XuhS91q.js";import{O as i,bt as a,i as o,k as s,l as c,ot as l,r as u}from"./index-pnImGbgQ.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as f}from"./StagePill-BwwKLcFl.js";import{t as p}from"./ImpactEstimate-Df_laG-n.js";import{t as m}from"./RowPagination-2icPidMP.js";import{i as h,r as g}from"./impact-sort-DxaUheWV.js";import{n as _,t as v}from"./finding-anchor-CDbHtqKT.js";import{t as y}from"./usePagedRows-jNUWgVTD.js";import{n as b,t as x}from"./useSortMode-DHlKZeWv.js";var S=e(t(),1),C=n();function w({finding:e}){let t=_([e]);return(0,C.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-2 ${v} transition-colors ${t.flashClassName}`,children:[e.stageIds&&e.stageIds.length>0?(0,C.jsx)(f,{pills:e.stageIds.map(e=>({id:e}))}):null,(0,C.jsxs)(`p`,{children:[e.recommendation,` `,(0,C.jsx)(p,{finding:e})]})]})}var T=(0,S.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:f,orderBy:p}=x(),[_,v]=(0,S.useState)(!t),[T,E]=(0,S.useState)(0),{findings:D,pills:O,groupConfidence:k}=(0,S.useMemo)(()=>{let t=e.filter(e=>e.type===`duplicatePlanSubtree`).sort((e,t)=>l[e.impactBand]-l[t.impactBand]);return{findings:t,pills:[...new Set(t.flatMap(e=>e.stageIds??[]))].map(e=>({id:e})),groupConfidence:t.every(e=>e.confidence===t[0]?.confidence)?t[0]:void 0}},[e]),A=p(D,e=>[e],h),j=c(),M=j?A.findIndex(e=>e===j.finding):null,{totalPages:N,effectivePage:P,visible:F}=y(A,T,E,M);return D.length===0?null:(0,C.jsxs)(o,{title:`Redundant Plan Subtree`,impactBand:a(D),open:_,onOpenChange:v,badges:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(i,{type:`duplicatePlanSubtree`,impactBand:a(D)??`info`,className:u}),g(D,D.length,_)?(0,C.jsx)(b,{mode:n,onChange:f}):null]}),statusBadge:(0,C.jsx)(s,{children:(0,C.jsx)(r,{confidence:k?.confidence,validationRequired:k?.validationRequired,evidenceKey:`sqlPlan`})}),summary:(0,C.jsx)(d,{value:`${O.length} stage${O.length===1?``:`s`}`,context:`${D.length} finding${D.length===1?``:`s`} flagged`}),children:[(0,C.jsx)(`ul`,{className:`space-y-3 text-sm`,children:F.map(e=>(0,C.jsx)(w,{finding:e},e.id))}),(0,C.jsx)(m,{page:P,totalPages:N,onPrev:()=>E(e=>e-1),onNext:()=>E(e=>e+1)})]})});export{T as DuplicatePlanSubtree};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,i as t,l as n,o as r,p as i,s as a,v as o}from"./charts-vendor-0VMaLVLN.js";import{p as s}from"./plan-graph-vendor-B0sEms9Z.js";import{T as c,w as l}from"./useRecentFiles-
|
|
1
|
+
import{f as e,i as t,l as n,o as r,p as i,s as a,v as o}from"./charts-vendor-0VMaLVLN.js";import{p as s}from"./plan-graph-vendor-B0sEms9Z.js";import{T as c,w as l}from"./useRecentFiles-0XuhS91q.js";import{Pt as u,lt as d}from"./index-pnImGbgQ.js";function f(e){let t=u(e=>e.exportMode);return{exportMode:t,getTaskData:t?void 0:e}}var p=s(),m=5,h=30,g=220;function _(e,t){if(e.length<2)return e[0]??null;let n=e[1]-e[0],r=Math.round((t-e[0])/n);return e[Math.min(e.length-1,Math.max(0,r))]}function v({metrics:s,fieldNames:u,markers:f={}}){let v=u.indexOf(`duration`);if(v===-1)return null;let y=u.length,b=s.length/y,x=[];for(let e=0;e<b;e++)x.push(s[e*y+v]);if(x.length<m)return(0,p.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Too few tasks (`,x.length,`) for a distribution.`]});let{labels:S,data:C}=d(x,h),w=S[1]-S[0],T=S.map((e,t)=>({bin:`${(e/1e3).toFixed(1)}s`,range:`${(e/1e3).toFixed(1)}s – ${((e+w)/1e3).toFixed(1)}s`,ms:e,count:C[t]})),E=f.p50==null?null:_(S,f.p50),D=f.p95==null?null:_(S,f.p95),O=E==null?void 0:T.find(e=>e.ms===E)?.bin,k=D==null?void 0:T.find(e=>e.ms===D)?.bin;return(0,p.jsx)(c,{title:`Task duration`,ariaLabel:`Task duration histogram`,height:g,table:{caption:`Task duration histogram`,columns:[`Duration bin`,`Task count`],rows:T.map(e=>[e.range,e.count]),align:[`right`,`right`]},children:(0,p.jsxs)(t,{data:T,children:[(0,p.jsx)(e,{vertical:!1,stroke:l.muted,strokeOpacity:.2}),(0,p.jsx)(a,{dataKey:`bin`,tick:{fontSize:10}}),(0,p.jsx)(r,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,p.jsx)(o,{formatter:e=>[`${Number(e)} task${Number(e)===1?``:`s`}`,`Count`],labelFormatter:(e,t)=>t?.[0]?.payload?.range??e}),(0,p.jsx)(n,{dataKey:`count`,name:`Tasks`,fill:l.accent}),O?(0,p.jsx)(i,{x:O,stroke:l.accent,label:`P50`}):null,k?(0,p.jsx)(i,{x:k,stroke:l.warning,label:`P95`}):null]})})}export{f as n,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{Lt as t}from"./index-
|
|
1
|
+
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{Lt as t}from"./index-pnImGbgQ.js";var n=e(),r={clean:{box:`border-clean/40 bg-clean/10`,icon:`text-clean`,title:`text-clean`},neutral:{box:`border-border/60 bg-muted/40`,icon:`text-muted-foreground`,title:`text-foreground`}};function i({icon:e,tone:i=`neutral`,title:a,description:o,action:s,className:c}){let l=r[i];return(0,n.jsxs)(`div`,{className:t(`flex items-start gap-3 rounded-xl border p-4`,l.box,c),children:[(0,n.jsx)(e,{"aria-hidden":`true`,className:t(`mt-0.5 size-4 shrink-0`,l.icon)}),(0,n.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,n.jsx)(`p`,{className:t(`text-sm font-medium`,l.title),children:a}),o?(0,n.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}):null]}),s]})}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,bt as a,ht as o,i as s,l as c,ot as l,pt as u}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,bt as a,ht as o,i as s,l as c,ot as l,pt as u}from"./index-pnImGbgQ.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as f}from"./ImpactEstimate-Df_laG-n.js";import{t as p}from"./RowPagination-2icPidMP.js";import{n as m}from"./finding-anchor-CDbHtqKT.js";import{t as h}from"./usePagedRows-jNUWgVTD.js";var g=e(t(),1),_=n();function v({finding:e}){let t=m([e]);return(0,_.jsxs)(`div`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[(0,_.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2`,children:[(0,_.jsx)(r,{impactBand:e.impactBand,className:`mt-1.5`}),(0,_.jsx)(`strong`,{children:u(`pct`,o(e))}),` average executor utilization`]}),(0,_.jsx)(f,{finding:e}),(0,_.jsx)(`p`,{children:e.recommendation})]})}var y=(0,g.memo)(function({catalog:e,defaultCollapsed:t=!0}){let[n,r]=(0,g.useState)(0),f=(0,g.useMemo)(()=>e.filter(e=>e.type===`utilization`).slice().sort((e,t)=>l[e.impactBand]-l[t.impactBand]),[e]),m=c(),y=m?f.findIndex(e=>e===m.finding):null,{totalPages:b,effectivePage:x,visible:S}=h(f,n,r,y);return f.length===0?null:(0,_.jsxs)(s,{title:`Executor Utilization`,impactBand:a(f),badges:(0,_.jsx)(i,{type:`utilization`,impactBand:a(f)??`info`}),defaultCollapsed:t,summary:(0,_.jsx)(d,{value:`${u(`pct`,o(f[0]))} average`,context:`${f.length} item${f.length===1?``:`s`} flagged`}),children:[(0,_.jsx)(`div`,{className:`space-y-2 text-sm`,children:S.map(e=>(0,_.jsx)(v,{finding:e},e.id))}),(0,_.jsx)(p,{page:x,totalPages:b,onPrev:()=>r(e=>e-1),onNext:()=>r(e=>e+1)})]})});export{y as ExecutorUtilization};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-0XuhS91q.js";import{O as i,bt as a,dt as o,i as s,k as c,l}from"./index-pnImGbgQ.js";import{t as u}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as d}from"./ImpactEstimate-Df_laG-n.js";import{t as f}from"./RowPagination-2icPidMP.js";import{r as p}from"./impact-sort-DxaUheWV.js";import{n as m,t as h}from"./finding-anchor-CDbHtqKT.js";import{t as g}from"./usePagedRows-jNUWgVTD.js";import{n as _,t as v}from"./useSortMode-DHlKZeWv.js";import{t as y}from"./StageHeader-CGeWqC-0.js";var b=e(t(),1),x=n(),S=`GC % = total JVM GC time ÷ total executor run time; it can exceed 100% when GC pauses overlap many concurrent task threads.`;function C(e){return[...e].sort((e,t)=>(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0))}function w({finding:e,appModel:t}){let n=m([e]),i=(e.stageId==null?void 0:t.stages.get(e.stageId))?.executorRunTime;return(0,x.jsxs)(`li`,{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-2 ${h} transition-colors ${n.flashClassName}`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,x.jsx)(y,{stageId:e.stageId,appModel:t}),(0,x.jsx)(c,{children:(0,x.jsx)(r,{confidence:e.confidence,validationRequired:e.validationRequired})})]}),(0,x.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`GC: `,(0,x.jsxs)(`strong`,{children:[e.value,`%`]}),` · Executor run time:`,` `,(0,x.jsx)(`strong`,{children:o(i??0)})]}),(0,x.jsx)(d,{finding:e}),(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.recommendation})]})}function T({title:e,findings:t,appModel:n,page:r,setPage:i,routeTarget:a,orderBy:o}){let s=o(C(t),e=>[e],e=>e.stageId),c=a?s.findIndex(e=>e===a.finding):null,{totalPages:l,effectivePage:u,visible:d}=g(s,r,i,c);return(0,x.jsxs)(`section`,{className:`space-y-2`,children:[(0,x.jsxs)(`h4`,{className:`font-heading text-sm font-medium`,children:[e,` · `,t.length,` stage`,t.length===1?``:`s`]}),(0,x.jsx)(`ul`,{className:`space-y-3`,children:d.map(e=>(0,x.jsx)(w,{finding:e,appModel:n},e.stageId))}),(0,x.jsx)(f,{page:u,totalPages:l,onPrev:()=>i(e=>e-1),onNext:()=>i(e=>e+1)})]})}function E({catalog:e,appModel:t,defaultCollapsed:n=!0}){let[r,o]=(0,b.useState)(0),[d,f]=(0,b.useState)(0),{sortMode:m,setSortMode:h,orderBy:g}=v(),[y,C]=(0,b.useState)(!n),w=l(),E=(0,b.useRef)(!1);(0,b.useEffect)(()=>{if(!E.current){E.current=!0;return}o(0),f(0)},[t]);let D=e.filter(e=>e.type===`gc`);if(D.length===0)return null;let O=D.filter(e=>e.direction!==`low`),k=D.filter(e=>e.direction===`low`),A=a(D),j=[...D].sort((e,t)=>(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0))[0];return(0,x.jsx)(s,{title:`GC Pressure`,impactBand:A,badges:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{type:`gc`,impactBand:A??`info`}),p(D,D.length,y)?(0,x.jsx)(_,{mode:m,onChange:e=>{h(e),o(0),f(0)}}):null]}),defaultCollapsed:n,open:y,onOpenChange:C,summary:(0,x.jsx)(u,{value:`${j.value}%`,context:`${D.length} stage${D.length===1?``:`s`} flagged`}),children:(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsx)(c,{children:(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:S})}),O.length>0&&(0,x.jsx)(T,{title:`GC overhead`,findings:O,appModel:t,page:r,setPage:o,routeTarget:w,orderBy:g}),k.length>0&&(0,x.jsx)(T,{title:`Low GC (cost)`,findings:k,appModel:t,page:d,setPage:f,routeTarget:w,orderBy:g})]})})}export{E as GcPressure};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{dt as r,ut as i}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{dt as r,ut as i}from"./index-pnImGbgQ.js";var a=e(t(),1),o=n();function s(e){return e===0?`0s`:r(e)}function c(e,t){let n=s(e),r=s(t);return n===r?r:`${n}-${r}`}function l(e){let t=Math.round(e.value*10)/10;switch(e.unit){case`bytes`:return i(e.value);case`ms`:return s(e.value);case`mbSeconds`:return`${t.toLocaleString(`en-US`)} MB-s`;case`coreHours`:return`${t.toFixed(1)} core-h`;case`coreMs`:return`${t.toLocaleString(`en-US`)} core-ms`;default:return String(e.value)}}function u(e){return/^0(\.0+)?(?:[^0-9.]|$)/.test(e)}function d(e){if(!e)return null;if(e.wallClock){if(e.wallClock.high<=0)return null;let t=s(e.wallClock.high);return u(t)?null:t}if(e.rawWaste){if(e.rawWaste.value<=0)return null;let t=l(e.rawWaste);return u(t)?null:t}return null}function f({finding:e}){let t=(0,a.useId)(),n=e.impactEstimate;if(!n)return null;let r=n.wallClock&&n.wallClock.high>0?s(n.wallClock.high):null,i=r&&!u(r)?c(n.wallClock.low,n.wallClock.high):null,d=n.rawWaste&&n.rawWaste.value>0?l(n.rawWaste):null,f=!i&&d&&!u(d)?d:null,p=i??f;if(!p)return null;let m=`Estimate method: ${n.estimateMethod}`;return(0,o.jsxs)(`span`,{className:`impact-estimate text-xs text-muted-foreground`,title:m,tabIndex:0,"aria-describedby":t,children:[`Potential savings: `,(0,o.jsx)(`strong`,{children:p}),(0,o.jsx)(`span`,{id:t,className:`sr-only`,children:m})]})}export{c as i,d as n,l as r,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{O as t,i as n}from"./index-
|
|
1
|
+
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{O as t,i as n}from"./index-pnImGbgQ.js";import{t as r}from"./ImpactEstimate-Df_laG-n.js";var i=e();function a({finding:e}){let{recommendation:t}=e;return(0,i.jsxs)(`div`,{className:`flex flex-col gap-1 transition-colors`,children:[(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`ApplicationEnd event: `,(0,i.jsx)(`strong`,{children:`missing`})]}),(0,i.jsx)(r,{finding:e}),(0,i.jsxs)(`div`,{className:`space-y-1 pt-1`,children:[(0,i.jsx)(`p`,{children:`This run’s event log never recorded an ApplicationEnd event.`}),t?(0,i.jsx)(`p`,{children:t}):null]})]})}function o({catalog:e,defaultCollapsed:r=!0}){let o=e.find(e=>e.type===`incompleteRun`);if(!o)return null;let{impactBand:s}=o;return(0,i.jsx)(n,{title:`Incomplete Run`,impactBand:s,badges:(0,i.jsx)(t,{type:`incompleteRun`,impactBand:s}),defaultCollapsed:r,children:(0,i.jsx)(a,{finding:o})})}export{o as IncompleteRun};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{O as t,i as n,k as r}from"./index-
|
|
1
|
+
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{O as t,i as n,k as r}from"./index-pnImGbgQ.js";import{t as i}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as a}from"./ImpactEstimate-Df_laG-n.js";var o=e();function s({finding:e}){let t=e.failedJobs,n=e.totalJobs,i=e.failedTasks,s=e.totalTasks,c=e.taskFailureRate,{value:l,recommendation:u}=e;return(0,o.jsxs)(`div`,{className:`flex flex-col gap-1 transition-colors`,children:[(0,o.jsxs)(`p`,{children:[`Failure rate: `,(0,o.jsxs)(`strong`,{children:[l,`%`]}),` (`,t,` of `,n,` completed jobs)`]}),(0,o.jsx)(r,{children:(0,o.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Task-failure context: `,i,` of `,s,` tasks failed (`,c,`%).`]})}),(0,o.jsx)(a,{finding:e}),u?(0,o.jsx)(`p`,{children:u}):null]})}function c({catalog:e,defaultCollapsed:r=!0}){let a=e.find(e=>e.type===`jobFailureRate`);if(!a)return null;let{impactBand:c,value:l}=a,u=a.failedJobs,d=a.totalJobs;return(0,o.jsx)(n,{title:`Job Failures`,impactBand:c,badges:(0,o.jsx)(t,{type:`jobFailureRate`,impactBand:c}),defaultCollapsed:r,summary:(0,o.jsx)(i,{value:`${l}%`,context:`${u} of ${d} completed jobs failed`}),children:(0,o.jsx)(s,{finding:a})})}export{c as JobFailures};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r,b as i}from"./useRecentFiles-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r,b as i}from"./useRecentFiles-0XuhS91q.js";import{D as a,O as o,bt as s,ht as c,i as l,k as u,l as d,ot as f,pt as p}from"./index-pnImGbgQ.js";import{t as m}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as h}from"./ImpactEstimate-Df_laG-n.js";import{t as g}from"./RowPagination-2icPidMP.js";import{n as _}from"./finding-anchor-CDbHtqKT.js";import{t as v}from"./usePagedRows-jNUWgVTD.js";var y=e(t(),1),b=n();function x(e){let t=c(e),n=p(`pct`,t);return e.variant===`idleCores`?`${n} of allocated core-time idle`:e.variant===`memoryBand`?e.rule===`heapNearCapacity`?`${n} of allocated heap used: near capacity`:`${n} of allocated heap used: over-provisioned`:`~${t.toLocaleString(`en-US`)} MB-seconds wasted`}function S(e){let t=e.recommendation??``,n=t.indexOf(`: `);return n===-1?` ${t}`:`; ${t.slice(n+2)}`}function C(e){if(e.rule==null)return null;let t=e.recommendation??``,n=t.indexOf(`: `);return n===-1?null:` ${t.slice(0,n)}.`}function w(e){return`executorId`in e&&e.executorId!=null?`Executor ${e.executorId}`:e.variant===`idleCores`?`Idle cores`:`Memory waste`}function T({finding:e}){let t=_([e]);return e.dataUnavailable?(0,b.jsx)(`div`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:(0,b.jsx)(u,{children:(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:e.recommendation})})}):(0,b.jsxs)(`div`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[(0,b.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2`,children:[(0,b.jsx)(a,{impactBand:e.impactBand,className:`mt-1.5`}),(0,b.jsx)(`strong`,{children:w(e)})]}),(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[x(e),S(e),C(e)==null?null:(0,b.jsx)(u,{children:C(e)})]}),(0,b.jsx)(h,{finding:e})]})}var E=(0,y.memo)(function({catalog:e,defaultCollapsed:t=!0}){let[n,a]=(0,y.useState)(0),{findings:c,groupConfidence:p}=(0,y.useMemo)(()=>{let t=e.filter(e=>e.type===`memoryUtilization`).sort((e,t)=>f[e.impactBand]-f[t.impactBand]),n=t.filter(i);return{findings:t,groupConfidence:n.every(e=>e.confidence===n[0]?.confidence)?n[0]:void 0}},[e]),h=d(),_=h?c.findIndex(e=>e===h.finding):null,{totalPages:x,effectivePage:S,visible:C}=v(c,n,a,_);if(!c.some(i))return null;let E=c.find(e=>!e.dataUnavailable)??c[0];return(0,b.jsxs)(l,{title:`Memory Utilization`,impactBand:s(c),badges:(0,b.jsx)(o,{type:`memoryUtilization`,impactBand:s(c)??`info`}),statusBadge:(0,b.jsx)(u,{children:(0,b.jsx)(r,{confidence:p?.confidence,validationRequired:p?.validationRequired,evidenceKey:`executorMetrics`})}),defaultCollapsed:t,summary:(0,b.jsx)(m,{value:w(E),context:`${c.length} item${c.length===1?``:`s`} flagged`}),children:[(0,b.jsx)(`div`,{className:`space-y-2 text-sm`,children:C.map(e=>(0,b.jsx)(T,{finding:e},e.id))}),(0,b.jsx)(g,{page:S,totalPages:x,onPrev:()=>a(e=>e-1),onNext:()=>a(e=>e+1)})]})});export{E as MemoryUtilization};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-0XuhS91q.js";import{O as i,bt as a,i as o,k as s,l as c,ot as l,r as u}from"./index-pnImGbgQ.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as f}from"./StagePill-BwwKLcFl.js";import{t as p}from"./ImpactEstimate-Df_laG-n.js";import{t as m}from"./RowPagination-2icPidMP.js";import{i as h,r as g}from"./impact-sort-DxaUheWV.js";import{n as _,t as v}from"./finding-anchor-CDbHtqKT.js";import{t as y}from"./usePagedRows-jNUWgVTD.js";import{n as b,t as x}from"./useSortMode-DHlKZeWv.js";var S=e(t(),1),C=n();function w({finding:e}){let t=_([e]);return(0,C.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-2 ${v} transition-colors ${t.flashClassName}`,children:[e.stageIds&&e.stageIds.length>0?(0,C.jsx)(f,{pills:e.stageIds.map(e=>({id:e}))}):null,(0,C.jsxs)(`p`,{children:[e.recommendation,` `,(0,C.jsx)(p,{finding:e})]})]})}var T=(0,S.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:f,orderBy:p}=x(),[_,v]=(0,S.useState)(!t),[T,E]=(0,S.useState)(0),{findings:D,pills:O}=(0,S.useMemo)(()=>{let t=e.filter(e=>e.type===`overBroadcast`).sort((e,t)=>l[e.impactBand]-l[t.impactBand]);return{findings:t,pills:[...new Set(t.flatMap(e=>e.stageIds??[]))].map(e=>({id:e}))}},[e]),k=p(D,e=>[e],h),A=c(),j=A?k.findIndex(e=>e===A.finding):null,{totalPages:M,effectivePage:N,visible:P}=y(k,T,E,j);return D.length===0?null:(0,C.jsxs)(o,{title:`Oversized Broadcast Join`,impactBand:a(D),open:_,onOpenChange:v,badges:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(i,{type:`overBroadcast`,impactBand:a(D)??`info`,className:u}),g(D,D.length,_)?(0,C.jsx)(b,{mode:n,onChange:f}):null]}),statusBadge:(0,C.jsx)(s,{children:(0,C.jsx)(r,{confidence:D[0].confidence,validationRequired:D[0].validationRequired,evidenceKey:`sqlPlan`})}),summary:(0,C.jsx)(d,{value:`${O.length} stage${O.length===1?``:`s`}`,context:`${D.length} finding${D.length===1?``:`s`} flagged`}),children:[(0,C.jsx)(`ul`,{className:`space-y-3 text-sm`,children:P.map(e=>(0,C.jsx)(w,{finding:e},e.id))}),(0,C.jsx)(m,{page:N,totalPages:M,onPrev:()=>E(e=>e-1),onNext:()=>E(e=>e+1)})]})});export{T as OverBroadcast};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{i as r}from"./useRecentFiles-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{i as r}from"./useRecentFiles-0XuhS91q.js";import{Ft as i,O as a,bt as o,ht as s,i as c,l,ot as u,ut as d}from"./index-pnImGbgQ.js";import{t as f}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as p}from"./ImpactEstimate-Df_laG-n.js";import{t as m}from"./RowPagination-2icPidMP.js";import{r as h}from"./impact-sort-DxaUheWV.js";import{n as g,t as _}from"./finding-anchor-CDbHtqKT.js";import{t as v}from"./usePagedRows-jNUWgVTD.js";import{n as y,t as b}from"./useSortMode-DHlKZeWv.js";import{t as x}from"./StageHeader-CGeWqC-0.js";import{a as S,i as C,n as w,r as T,t as E}from"./select-C-MZGNpb.js";import{t as D}from"./PlanExplorer-DjGTZifP.js";var O=e(t(),1),k=n();function A(e){if(e.rule===`lowShuffleParallelism`)return`${s(e)} tasks carrying the shuffle`;let t=s(e);return e.rule===`maxPartitionTooBig`?`Largest partition ${d(t)} (too large)`:`Largest partition ${d(t)}`}function j({entry:e,appModel:t}){let n=i(),a=g(e.partitions),o=n===`advanced`&&r(e.stageId,t);return(0,k.jsxs)(`div`,{ref:a.ref,tabIndex:a.tabIndex,"data-flashed":a.dataFlashed,className:`space-y-2 ${_} transition-colors ${a.flashClassName}`,children:[(0,k.jsx)(x,{stageId:e.stageId,appModel:t}),(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.partitions.map((e,t)=>(0,k.jsxs)(`span`,{children:[t>0?` · `:``,A(e)]},e.id))}),(0,k.jsx)(p,{finding:e.partitions[0]}),(0,k.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,k.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-xs text-muted-foreground`,children:e.partitions.map(e=>(0,k.jsxs)(`li`,{children:[e.recommendation,` `,(0,k.jsx)(p,{finding:e})]},e.id))}),o?(0,k.jsx)(D,{stageId:e.stageId,appModel:t}):null]})]})}var M=(0,O.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let[r,i]=(0,O.useState)(0),[s,d]=(0,O.useState)(!n),{sortMode:p,setSortMode:g,orderBy:_}=b(),x=l(),{partitionFindings:D,sorted:A,orderedEntries:M}=(0,O.useMemo)(()=>{let e=t.filter(e=>e.type===`partitionSizing`),n=new Map;for(let t of e){if(t.stageId==null)continue;let e=n.get(t.stageId);e?(e.partitions.push(t),u[t.impactBand]<u[e.impactBand]&&(e.impactBand=t.impactBand)):n.set(t.stageId,{stageId:t.stageId,partitions:[t],impactBand:t.impactBand})}let r=[...n.values()].sort((e,t)=>u[e.impactBand]-u[t.impactBand]||e.stageId-t.stageId);return{partitionFindings:e,sorted:r,orderedEntries:_(r,e=>e.partitions,e=>e.stageId)}},[t,p]),N=x?M.findIndex(e=>e.partitions.includes(x.finding)):null,{totalPages:P,effectivePage:F,visible:I}=v(M,r,i,N);if(D.length===0){let t=e.stages.size;return(0,k.jsx)(c,{title:`Partition Sizing`,open:s,onOpenChange:d,summary:(0,k.jsx)(f,{value:`No issues`,context:`no issue detected: partition sizing checked across ${t} stage${t===1?``:`s`}`}),children:(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No partition-sizing issues detected.`})})}let L=o(D),R=h(D,A.length,s);return(0,k.jsx)(c,{title:`Partition Sizing`,impactBand:L,open:s,onOpenChange:d,summary:(0,k.jsx)(f,{value:`Stage ${A[0].stageId}`,context:`${A.length} stage${A.length===1?``:`s`} flagged`}),badges:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(a,{type:`partitionSizing`,impactBand:L??`info`}),R?(0,k.jsx)(y,{mode:p,onChange:e=>{g(e),i(0)}}):null]}),children:(0,k.jsxs)(`div`,{className:`space-y-4`,children:[I.map(t=>(0,k.jsx)(j,{entry:t,appModel:e},t.stageId)),(0,k.jsx)(m,{page:F,totalPages:P,onPrev:()=>i(e=>e-1),onNext:()=>i(e=>e+1),renderJumpControl:()=>(0,k.jsxs)(E,{value:String(F*6),onValueChange:e=>i(Math.floor(Number(e)/6)),children:[(0,k.jsx)(C,{size:`sm`,"aria-label":`Jump to stage`,children:(0,k.jsx)(S,{placeholder:`Jump to stage`})}),(0,k.jsx)(w,{children:M.map((e,t)=>(0,k.jsxs)(T,{value:String(t),children:[`Stage `,e.stageId]},e.stageId))})]})})]})})});export{M as PartitionSizing};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{i as r,r as i}from"./useRecentFiles-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{i as r,r as i}from"./useRecentFiles-0XuhS91q.js";import{C as a,Ot as o,S as s,kt as c,x as l}from"./index-pnImGbgQ.js";var u=e(t(),1),d=n();function f({stageId:e,appModel:t}){let[n,f]=(0,u.useState)(!1);return r(e,t)?(0,d.jsx)(`div`,{className:`space-y-3`,children:(0,d.jsxs)(l,{open:n,onOpenChange:f,children:[(0,d.jsxs)(a,{"aria-expanded":String(n),className:`flex cursor-pointer items-center gap-2 bg-transparent text-left`,children:[(0,d.jsx)(`h3`,{className:`font-heading text-sm font-medium`,children:`Plan context`}),n?(0,d.jsx)(o,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}):(0,d.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`})]}),(0,d.jsx)(s,{keepMounted:!0,children:(0,d.jsx)(`div`,{className:`pt-3`,children:(0,d.jsx)(i,{stageId:e,appModel:t})})})]})}):null}export{f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{C as n,S as r,T as i,_ as a,b as o,g as s,h as c,m as l,v as u,w as d,x as f,y as p}from"./react-vendor-D2TLlSzI.js";import{a as m,c as h,d as g,f as _,i as v,l as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E}from"./plan-graph-vendor-B0sEms9Z.js";import{c as D,f as O,i as ee,l as te,n as k,o as A,s as j,t as ne,u as M,w as N}from"./useRecentFiles-BiYdWs8J.js";import{$ as P,A as re,At as F,D as I,E as L,F as R,G as z,L as ie,Lt as B,Nt as V,O as ae,P as H,Q as oe,T as U,Tt as se,at as ce,bt as le,dt as ue,et as de,ft as fe,it as W,nt as pe,rt as me,tt as G,ut as he,w as ge,xt as _e,yt as ve}from"./index-U654cmB8.js";import{t as ye}from"./impact-sort-DxaUheWV.js";var be={name:`arrow-left-right`,size:24,node:[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]};be.node;var xe=F(be),Se={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};Se.node;var Ce=F(Se),we={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};we.node;var Te=F(we),Ee={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};Ee.node;var De=F(Ee),Oe={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Oe.node;var ke=F(Oe),Ae={name:`timer`,size:24,node:[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]};Ae.node;var je=F(Ae),Me={name:`zoom-out`,size:24,node:[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]};Me.node;var Ne=F(Me),Pe={name:`zoom-in`,size:24,node:[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]};Pe.node;var Fe=F(Pe),K=e(t(),1);function Ie({id:e,sourceNodeId:t,planNode:n,category:r,segmentIndex:i,splitRole:a,durationShare:o,exclusiveDurationShare:s,findings:c}){return{id:e,sourceNodeId:t,label:n.name,category:r,operatorDetail:pe(n.name,n.detail??``),primaryMetric:G(n.metrics),segmentIndex:i,splitRole:a,durationShare:o??null,exclusiveDurationShare:s??null,findings:c,metrics:(n.metrics??[]).map(e=>({name:e.name,value:de(e)})),detailText:n.detail&&n.detail!==n.name?n.detail:``}}function Le(e,t){let{scope:n,stageId:r,appModel:i,findings:a=[],durationMode:o=`exclusive`}=t;if(!e)return{nodes:[],edges:[],segmentIndex:null,segmentCount:0,scope:`full`,segmentStageIds:new Map};let s=i.stages.get(r)?.sqlExecutionId??null,c=s==null?null:i.sql.get(s),{segments:l,segOf:u,segmentTopology:d}=me(e),f=l.filter(Boolean).length,p=c&&s!=null?oe(e,i,c,s,o):null,m=o===`exclusive`?p:c&&s!=null?oe(e,i,c,s,`exclusive`):null,h=new Map,g=c&&s!=null?z(s,i.stages):[];if(g.length){let e=new Map;for(let t of g){let n=i.stages.get(t);n&&e.set(t,{submittedAt:n.submittedAt,completedAt:n.completedAt})}for(let[t,n]of W(l,e,g,d))h.set(t,n)}let _=new Map;if(s!=null){for(let e of a)if(e.executionId===s)for(let t of e.planNodeIds??[]){let n=_.get(t);n?n.push(e):_.set(t,[e])}}let v=[],y=[],b=new Map;ce(e,(e,t)=>{let n=e.id,r=P(e.name),a=u.get(e),o=t?t.id:null,s=e.exchangeRole===`write`&&t?t.id:n,c=Ie({id:n,sourceNodeId:s,planNode:e,category:r,segmentIndex:a,splitRole:e.exchangeRole??null,durationShare:p?.get(e),exclusiveDurationShare:m?.get(e),findings:_.get(n)??[]});if(v.push(c),e.exchangeRole){let t=b.get(s)??{};t[e.exchangeRole]=c,b.set(s,t)}if(o){let t={id:`${o}->${n}`,source:o,target:n};if(e.exchangeRole===`write`){let e=h.get(a),n=e==null?void 0:i.stages.get(e),r=n?.shuffleWriteBytes||n?.shuffleReadBytes;if(r){t.shuffleBytes=r;let e=b.get(s)??{};e.shuffleBytes=r,b.set(s,e)}}y.push(t)}},{dedupe:!0});for(let{read:e,write:t,shuffleBytes:n}of b.values())e&&t&&(e.pairedNodeId=t.id,t.pairedNodeId=e.id),n!=null&&(e&&(e.exchangeShuffleBytes=n),t&&(t.exchangeShuffleBytes=n));if(n===`full`)return{nodes:v,edges:y,segmentIndex:null,segmentCount:f,scope:`full`,segmentStageIds:h};let x=null;for(let[e,t]of h)if(t===r){x=e;break}if(x===null)return{nodes:v,edges:y,segmentIndex:null,segmentCount:f,scope:`full`,segmentStageIds:h};let S=new Set;return{nodes:v.filter(e=>e.segmentIndex===x&&(S.add(e.id),!0)),edges:y.filter(e=>S.has(e.source)&&S.has(e.target)),segmentIndex:x,segmentCount:f,scope:`segment`,segmentStageIds:h}}var Re=24,ze=32;function q(e,t,n={}){let r=new T.graphlib.Graph({compound:!!n.groupOf});r.setGraph({rankdir:`RL`,nodesep:128,ranksep:60,ranker:`tight-tree`}),r.setDefaultEdgeLabel(()=>({}));let i=new Set;if(n.groupOf){for(let t of e){let e=n.groupOf(t);e&&i.add(e)}for(let e of i)r.setNode(e,{})}for(let t of e){r.setNode(t.id,{width:220,height:90});let e=n.groupOf?.(t);e&&r.setParent(t.id,e)}for(let e of t)r.setEdge(e.source,e.target);return T.layout(r),e.map(e=>{let t=r.node(e.id);return{...e,position:{x:t.x-110,y:t.y-45}}})}function Be(e,t,n={}){let r=n.paddingX??Re,i=n.paddingY??Re,a=n.headerHeight??ze,o=new Map;for(let n of e){let e=t(n);if(!e)continue;let r=n.position.x,i=n.position.y,a=r+220,s=i+90,c=o.get(e);c?(c.minX=Math.min(c.minX,r),c.minY=Math.min(c.minY,i),c.maxX=Math.max(c.maxX,a),c.maxY=Math.max(c.maxY,s)):o.set(e,{minX:r,minY:i,maxX:a,maxY:s})}return[...o.entries()].map(([e,t])=>({id:e,position:{x:t.minX-r,y:t.minY-i-a},width:t.maxX-t.minX+r*2,height:t.maxY-t.minY+i*2+a}))}function J(e,t,n={}){let r=new Set,i=[];for(let a of t){let t=t=>{let n=e(t);return n&&!r.has(n)?n:null};for(let e of Be(a,t,n))r.add(e.id),i.push(e)}return i}var Y=S();function Ve({delay:e=0,...t}){return(0,Y.jsx)(p,{"data-slot":`tooltip-provider`,delay:e,...t})}function He({...e}){return(0,Y.jsx)(i,{"data-slot":`tooltip`,...e})}function Ue({...e}){return(0,Y.jsx)(d,{"data-slot":`tooltip-trigger`,...e})}function We({className:e,side:t=`top`,sideOffset:i=4,align:a=`center`,alignOffset:s=0,children:c,...l}){return(0,Y.jsx)(n,{children:(0,Y.jsx)(r,{align:a,alignOffset:s,side:t,sideOffset:i,className:`isolate z-50`,children:(0,Y.jsxs)(f,{"data-slot":`tooltip-content`,className:B(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none`,e),...l,children:[c,(0,Y.jsx)(o,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}function Ge(e){return e==null?null:e>=40?`critical`:e>=15?`warning`:`info`}var X={scan:`⇩`,exchange:`⇄`,join:`⋈`,aggregate:`Σ`,sort:`↕`,filter:`∇`,aqe:`⚙`,boilerplate:`·`,transform:`→`};function Ke(e){return e.find(e=>e.impactBand===`critical`)??e.find(e=>e.impactBand===`warning`)??e[0]}function qe({data:e}){let{label:t,operatorDetail:n,primaryMetric:r,category:i,splitRole:a,durationSharePct:o,findings:s}=e,c=X[i]??X.transform,l=Ge(o);return(0,Y.jsxs)(`div`,{className:`relative flex flex-col overflow-visible rounded-md border border-border bg-card px-3 py-2 text-xs shadow-sm`,style:{width:220,height:90},"data-category":i,children:[(0,Y.jsx)(m,{type:`target`,position:g.Right,className:`opacity-0!`}),(0,Y.jsx)(m,{type:`source`,position:g.Left,className:`opacity-0!`}),s&&s.length>0?(()=>{let e=Ke(s);return(0,Y.jsxs)(He,{children:[(0,Y.jsxs)(Ue,{"data-testid":`node-finding-badge`,className:B(`absolute -right-1 -top-1 flex items-center gap-1 rounded-full bg-card px-1.5 py-0.5 text-[10px] font-medium leading-none shadow-sm ring-1 ring-border`,L[e.impactBand]),children:[(0,Y.jsx)(I,{impactBand:e.impactBand}),ve(e.type),s.length>1?(0,Y.jsx)(`span`,{children:s.length}):null]}),(0,Y.jsx)(We,{className:`max-w-xs`,children:(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1 text-left`,children:s.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(I,{impactBand:e.impactBand}),(0,Y.jsx)(`span`,{children:O(e)})]},e.id??`${e.type}-${t}`))})})]})})():null,a===`read`?(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:`paired: see write half`}):null,o!=null&&l?(0,Y.jsxs)(`div`,{className:`mb-1 flex shrink-0 items-center gap-1.5`,title:`Share of the plan's total stage wall time`,children:[(0,Y.jsxs)(`span`,{className:B(`shrink-0 text-[10px] font-medium tabular-nums`,L[l]),children:[o,`%`]}),(0,Y.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`div`,{"data-testid":`duration-heat-bar-fill`,className:B(`h-full rounded-full`,U[l]),style:{width:`${o>0?Math.max(o,4):0}%`}})}),(0,Y.jsxs)(`span`,{className:`sr-only`,children:[`Duration share `,o,`%, `,l===`critical`?`high`:l===`warning`?`medium`:`low`]})]}):null,(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:c}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-medium`,title:t,children:t})]}),n?(0,Y.jsx)(`p`,{className:`truncate text-muted-foreground`,title:n,children:n}):null,r?(0,Y.jsx)(`p`,{className:`truncate text-muted-foreground`,title:r,children:r}):null]})}var Je={read:`Read half. Consumes the shuffle written by its paired write half.`,write:`Write half. Produces the shuffle its paired read half consumes.`};function Ye({node:e,onClose:t,onJumpToPaired:n}){let r=X[e.category]??X.transform,i=e.findings??[],a=e.metrics??[],o=e.category.charAt(0).toUpperCase()+e.category.slice(1);return(0,Y.jsxs)(`div`,{"data-testid":`plan-node-detail`,role:`dialog`,"aria-label":`Plan node detail: ${e.label}`,className:`flex h-full w-80 shrink-0 flex-col gap-3 overflow-y-auto border-l border-border bg-card p-3 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:r}),(0,Y.jsx)(`span`,{className:`break-words font-medium`,children:e.label})]}),(0,Y.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,"aria-label":`Close node detail`,onClick:t,children:(0,Y.jsx)(_e,{className:`size-4`})})]}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground`,children:[o,` · Segment `,e.segmentIndex+1,e.durationSharePct==null?null:(0,Y.jsxs)(Y.Fragment,{children:[` · `,(0,Y.jsxs)(`span`,{className:`text-foreground`,children:[e.durationSharePct,`%`]}),` of plan stage time`]})]}),e.splitRole?(0,Y.jsxs)(Z,{title:`Exchange`,children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:Je[e.splitRole]}),e.exchangeShuffleBytes==null?e.label.startsWith(`Broadcast`)?(0,Y.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Broadcast, no shuffle`}):null:(0,Y.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`Shuffle written`,` `,(0,Y.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:he(e.exchangeShuffleBytes)})]}),e.pairedNodeId&&n?(0,Y.jsxs)(H,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2 h-7 w-full justify-start gap-1.5`,onClick:()=>n(e.pairedNodeId),children:[(0,Y.jsx)(xe,{className:`size-3.5`,"aria-hidden":`true`}),`Jump to `,e.splitRole===`read`?`write`:`read`,` half`]}):null]}):null,i.length>0?(0,Y.jsx)(Z,{title:`Findings`,children:(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:i.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-1.5`,children:[(0,Y.jsx)(ae,{type:e.type,impactBand:e.impactBand,docAnchor:e.docAnchor,className:`shrink-0`}),(0,Y.jsx)(`span`,{className:`break-words`,children:O(e)})]},e.id??`${e.type}-${t}`))})}):null,a.length>0?(0,Y.jsx)(Z,{title:`Metrics`,children:(0,Y.jsx)(`dl`,{className:`grid grid-cols-[1fr_auto] gap-x-3 gap-y-1`,children:a.map((e,t)=>(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsx)(`dt`,{className:`min-w-0 break-words text-muted-foreground`,children:e.name}),(0,Y.jsx)(`dd`,{className:`text-right font-medium tabular-nums`,children:e.value})]},`${e.name}-${t}`))})}):null,e.detailText?(0,Y.jsx)(Z,{title:`Plan detail`,children:(0,Y.jsx)(`pre`,{"data-testid":`plan-node-detail-text`,className:`max-h-48 overflow-auto whitespace-pre-wrap break-words rounded bg-muted p-2 font-mono text-[11px] leading-snug`,children:e.detailText})}):null]})}function Z({title:e,children:t}){return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-1 font-medium text-muted-foreground`,children:e}),t]})}var Xe=[{category:`scan`,label:`Scan`},{category:`filter`,label:`Filter`},{category:`join`,label:`Join`},{category:`aggregate`,label:`Aggregate`},{category:`sort`,label:`Sort`},{category:`exchange`,label:`Exchange`},{category:`transform`,label:`Transform`}];function Ze(){return(0,Y.jsxs)(`div`,{"data-testid":`plan-graph-legend`,role:`region`,"aria-label":`Plan graph legend`,className:`flex max-w-md flex-col gap-2 rounded-md border border-border bg-card p-3 text-xs shadow-md`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-1 font-medium text-muted-foreground`,children:`Operators`}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:Xe.map(({category:e,label:t})=>(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:X[e]}),t]},e))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-1 font-medium text-muted-foreground`,children:`Duration share`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:B(`h-1.5 w-6 rounded-full`,U.info)}),` low`]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:B(`h-1.5 w-6 rounded-full`,U.warning)}),` medium`]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:B(`h-1.5 w-6 rounded-full`,U.critical)}),` high`]})]})]}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`text-foreground`,children:`Edge thickness`}),` = shuffle bytes moved across an exchange.`]}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground`,children:[`A `,(0,Y.jsx)(`span`,{className:`text-foreground`,children:`segment`}),` box groups one Exchange-bounded stage of the plan; a`,` `,(0,Y.jsx)(`span`,{className:`text-foreground`,children:`stage`}),` box (full-plan view) wraps every segment of one Spark stage.`]})]})}function Qe({...e}){return(0,Y.jsx)(u,{"data-slot":`popover`,...e})}function $e({...e}){return(0,Y.jsx)(a,{"data-slot":`popover-trigger`,...e})}function et({align:e=`center`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=8,className:i,...a}){return(0,Y.jsx)(s,{children:(0,Y.jsx)(c,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,Y.jsx)(l,{"data-slot":`popover-content`,className:B(`z-50 w-72 origin-(--transform-origin) rounded-lg bg-popover p-3 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none`,i),...a})})})}function tt({ariaLabel:e,name:t,options:n,value:r,onChange:i,trailingContent:a}){return(0,Y.jsx)(Ve,{children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,role:`radiogroup`,"aria-label":e,children:[n.map(e=>(0,Y.jsxs)(He,{children:[(0,Y.jsxs)(Ue,{render:(0,Y.jsx)(`label`,{className:`tap-target-comfortable flex min-h-8 items-center gap-1.5 px-1 text-sm`}),children:[(0,Y.jsx)(`input`,{type:`radio`,name:t,value:e.value,checked:r===e.value,onChange:()=>i(e.value)}),e.label]}),(0,Y.jsx)(We,{children:e.description})]},e.value)),a]})})}var nt=[{value:`io`,label:`I/O only`,description:`Show only scan and exchange nodes, where the plan reads or shuffles/broadcasts data.`},{value:`basic`,label:`Basic`,description:`Add join, aggregate, sort, and filter nodes to I/O; hide pass-through and boilerplate operators like Project or WholeStageCodegen.`},{value:`advanced`,label:`Advanced`,description:`Show every operator, including the pass-through and boilerplate nodes the other two modes hide.`}];function rt({mode:e,onChange:t,hiddenCount:n}){return(0,Y.jsx)(tt,{ariaLabel:`Node filter`,name:`plan-graph-filter`,options:nt,value:e,onChange:t,trailingContent:n>0?(0,Y.jsx)(ge,{label:`${n} nodes hidden`,impactBand:`info`}):null})}var it=[{value:`exclusive`,label:`Node only`,description:`Each node's share reflects time spent in that operator alone, excluding its descendants.`},{value:`inclusive`,label:`Node + descendants`,description:`Each node's share adds in every descendant operator's time, so an ancestor's bar reflects its whole subtree.`}];function at({mode:e,onChange:t}){return(0,Y.jsx)(tt,{ariaLabel:`Duration heat bar scope`,name:`plan-graph-duration-mode`,options:it,value:e,onChange:t})}function ot({filterMode:e,onFilterModeChange:t,hiddenCount:n,durationMode:r,onDurationModeChange:i,iconOnly:a=!1}){return(0,Y.jsxs)(Qe,{children:[(0,Y.jsxs)($e,{"aria-label":a?`Settings`:void 0,title:a?`Settings`:void 0,className:B(R({variant:`ghost`,size:a?`icon`:`sm`}),`tap-target-comfortable`,a?void 0:`gap-1.5`),children:[(0,Y.jsx)(ke,{"aria-hidden":`true`}),a?null:`Settings`]}),(0,Y.jsxs)(et,{align:a?`start`:`end`,side:a?`right`:`bottom`,"aria-label":`Plan graph settings`,className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:`Node filter`}),(0,Y.jsx)(rt,{mode:e,onChange:t,hiddenCount:n})]}),(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`h-px bg-border`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:`Duration attribution`}),(0,Y.jsx)(at,{mode:r,onChange:i})]})]})]})}var st=e=>e.data;function ct({planNodes:e,problemNodes:t,filterMode:n,onFilterModeChange:r,hiddenCount:i,durationMode:a,onDurationModeChange:o,legendOpen:s,onToggleLegend:c,miniMapOpen:l,onToggleMiniMap:u}){let{zoomIn:d,zoomOut:f,fitView:p,setCenter:m}=E(),[h,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(null),y=[...e].filter(e=>st(e).durationSharePct!=null).sort((e,t)=>(st(t).durationSharePct??0)-(st(e).durationSharePct??0)),b=e=>{e&&m(e.position.x,e.position.y,{zoom:1,duration:300})},x=(e,t,n)=>{if(e.length===0)return;let r=e[((t?e.findIndex(e=>e.id===t):-1)+1)%e.length];b(r),n(r.id)};return(0,Y.jsxs)(`div`,{className:`flex w-12 shrink-0 flex-col items-center gap-1 border-r border-border bg-card/60 py-2`,children:[(0,Y.jsxs)(lt,{children:[(0,Y.jsx)(Q,{label:`Zoom in`,onClick:()=>d({duration:200}),children:(0,Y.jsx)(Fe,{"aria-hidden":`true`})}),(0,Y.jsx)(Q,{label:`Zoom out`,onClick:()=>f({duration:200}),children:(0,Y.jsx)(Ne,{"aria-hidden":`true`})}),(0,Y.jsx)(Q,{label:`Fit to view`,onClick:()=>p({duration:200}),children:(0,Y.jsx)(De,{"aria-hidden":`true`})})]}),(0,Y.jsx)(ut,{}),(0,Y.jsxs)(lt,{children:[(0,Y.jsx)(Q,{label:`Next worst duration`,disabled:y.length===0,onClick:()=>x(y,h,g),children:(0,Y.jsx)(je,{"aria-hidden":`true`})}),t.length>0?(0,Y.jsx)(Q,{label:`Next problem`,onClick:()=>x(t,_,v),children:(0,Y.jsx)(Ce,{"aria-hidden":`true`})}):null]}),(0,Y.jsx)(ut,{}),(0,Y.jsxs)(lt,{children:[(0,Y.jsx)(ot,{iconOnly:!0,filterMode:n,onFilterModeChange:r,hiddenCount:i,durationMode:a,onDurationModeChange:o}),(0,Y.jsx)(Q,{label:s?`Hide legend`:`Legend`,pressed:s,onClick:c,children:(0,Y.jsx)(se,{"aria-hidden":`true`})}),(0,Y.jsx)(Q,{label:l?`Hide minimap`:`Show minimap`,pressed:l,onClick:u,children:(0,Y.jsx)(Te,{"aria-hidden":`true`})})]})]})}function lt({children:e}){return(0,Y.jsx)(`div`,{className:`flex flex-col items-center gap-1`,children:e})}function ut(){return(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`my-0.5 h-px w-6 bg-border`})}function Q({label:e,onClick:t,disabled:n,pressed:r,children:i}){return(0,Y.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:B(`tap-target-comfortable`,r&&`bg-primary/15 text-primary hover:bg-primary/20 hover:text-primary`),"aria-label":e,title:e,"aria-pressed":r,disabled:n,onClick:t,children:i})}function dt(e){if(e.type!==`planNode`)return`var(--muted)`;let t=e.data.findings??[],n=le(t);return n?N[n]:`var(--plan-aggregate)`}function ft({finding:e,className:t}){let n=fe(e);return(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(ae,{type:e.type,impactBand:e.impactBand,docAnchor:e.docAnchor,className:t}),n?(0,Y.jsx)(`span`,{className:`font-mono text-[10px] leading-none whitespace-nowrap text-muted-foreground`,children:n}):null]})}function pt({data:e}){let{width:t,height:n,stageId:r,durationLabel:i,findings:a}=e;return(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-dashed border-border/70 bg-muted/10 nopan nodrag`,style:{width:t,height:n,pointerEvents:`all`},children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-2 py-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{title:r==null?`This plan segment couldn't be matched to a specific Spark stage`:void 0,children:r==null?`Stage —`:`Stage ${r}`}),(0,Y.jsx)(ge,{label:i??`—`,impactBand:`info`,title:`Approximate share of this stage's wall time`}),a.length>0?(0,Y.jsx)(`div`,{className:`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1`,children:a.map((e,t)=>(0,Y.jsx)(ft,{finding:e,className:`h-4 gap-1 px-1.5 text-xs`},e.id??`${e.type}-${t}`))}):null]})})}function mt({data:e}){let{width:t,height:n,stageId:r,findings:i,showOwnFindings:a=!0,onSelect:o}=e;return(0,Y.jsxs)(`div`,{className:`relative rounded-xl border border-primary/25 bg-primary/5 nopan nodrag`,style:{width:t,height:n,pointerEvents:`all`},children:[(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Focus stage ${r}`,onClick:o,style:{pointerEvents:`auto`},className:`absolute inset-0 size-full cursor-pointer rounded-xl transition-colors hover:border-primary/50 hover:bg-primary/10`}),a&&i.length>0?(0,Y.jsx)(`div`,{className:`absolute left-2 right-2 top-1 flex flex-wrap gap-1`,children:i.map((e,t)=>(0,Y.jsx)(ft,{finding:e,className:`h-4 gap-1 px-1.5 text-xs`},e.id??`${e.type}-${t}`))}):null,(0,Y.jsxs)(`span`,{className:`absolute right-2 bottom-1 text-xs font-medium text-primary`,children:[`Stage `,r]})]})}var ht=1.5,gt=.55;function _t(e,t){return!(e>0)||!(t>0)?0:Math.min(1,Math.log(e+1)/Math.log(t+1))}function vt(e,t){return ht+7.5*_t(e,t)}function yt(e,t){return gt+.44999999999999996*_t(e,t)}function bt({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i,targetPosition:a,markerEnd:o,data:s}){let[c,l,u]=_({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i,targetPosition:a}),{shuffleBytes:d=0,maxShuffleBytes:f=0}=s??{},p=vt(d,f),m=yt(d,f),h=d>0&&d<1e3?`<1 KB`:he(d);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(C,{path:c,markerEnd:o,style:{stroke:`var(--text-muted)`,strokeWidth:p,strokeOpacity:m}}),(0,Y.jsx)(v,{children:(0,Y.jsxs)(He,{children:[(0,Y.jsx)(Ue,{"data-testid":`exchange-edge-label`,className:`nodrag nopan pointer-events-auto absolute cursor-help rounded bg-card/90 px-1 py-0.5 font-mono text-[10px] leading-none text-muted-foreground ring-1 ring-border`,style:{transform:`translate(-50%, -50%) translate(${l}px, ${u}px)`},children:h}),(0,Y.jsx)(We,{className:`max-w-xs`,children:(0,Y.jsxs)(`p`,{children:[h,` of shuffle written across this exchange. Edge thickness scales with the volume moved.`]})})]})})]})}var xt={planNode:qe,segmentGroup:pt,stageGroup:mt},St={exchange:bt},Ct=1,wt=2,Tt=3,Et=e=>e.data,$={padding:.06,maxZoom:1.75};function Dt({resizeTick:e,fitSignal:t,centerRequest:n}){let{fitView:r,setCenter:i,getNode:a}=E();return(0,K.useEffect)(()=>{if(!n||n.token===0||!n.nodeId)return;let e=a(n.nodeId);e?i(e.position.x,e.position.y,{zoom:1,duration:300}):r({nodes:[{id:n.nodeId}],duration:300,maxZoom:1})},[n,i,a,r]),(0,K.useEffect)(()=>{let e=()=>r({duration:200,...$});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[r]),(0,K.useEffect)(()=>{e!==0&&r({duration:200,...$})},[e,r]),(0,K.useEffect)(()=>{t!==0&&r({duration:300,...$})},[t,r]),null}function Ot(){let e=(0,K.useRef)(null),[t,n]=(0,K.useState)(0);return(0,K.useEffect)(()=>{let t=e.current;if(!t)return;let r=!0,i=new ResizeObserver(()=>{if(r){r=!1;return}n(e=>e+1)});return i.observe(t),()=>i.disconnect()},[]),{ref:e,tick:t}}function kt(e,t){return e.filter(e=>e.stageId===t||e.stageIds?.includes(t))}function At({model:e,showMiniMap:t,findings:n=[],stageId:r,segmentStageIds:i,visibleNodeIds:a,visibleEdges:o,onSelectStage:s,selectedNodeId:c=null,onSelectNode:l,onJumpToPaired:u,centerRequest:d,fitSignal:f=0,filterMode:p=`basic`,onFilterModeChange:m=()=>{},hiddenCount:g=0,durationMode:_=`exclusive`,onDurationModeChange:v=()=>{}}){let{flowNodes:S,flowEdges:C}=(0,K.useMemo)(()=>{let t=e.nodes.reduce((e,t)=>e+(t.exclusiveDurationShare??t.durationShare??0),0),c=e=>`segment-${e.segmentIndex}`,l=e.scope===`full`,u=e=>{let t=i?.get(e.segmentIndex);return t==null?null:`stage-${t}`},d=a?q(e.nodes.filter(e=>a.has(e.id)),o??e.edges,{groupOf:c}):q(e.nodes,e.edges,{groupOf:c}),f=new Set(d.map(c)),p=l?new Set(d.map(u).filter(e=>e!=null)):null,m=e.nodes.some(e=>!f.has(c(e)))||p!=null&&e.nodes.some(e=>{let t=u(e);return t!=null&&!p.has(t)})?q(e.nodes,e.edges,{groupOf:c}):d,h=d.map(e=>{let n=e.durationShare!=null&&t>0?Math.round(e.durationShare/t*100):null,r=e.splitRole===`read`?`${e.label}, paired: see write half`:[e.label,e.operatorDetail,e.primaryMetric,n==null?null:`${n}% of the plan's total stage duration`].filter(Boolean).join(`, `);return{id:e.id,type:`planNode`,position:e.position,draggable:!1,zIndex:Tt,measured:{width:220,height:90},ariaLabel:r,ariaRole:`button`,data:{...e,durationSharePct:n}}}),g=J(c,[d,m]).map(t=>{let r=Number(t.id.replace(`segment-`,``)),a=e.nodes.filter(e=>c(e)===t.id),o=a.reduce((e,t)=>e+(t.exclusiveDurationShare??t.durationShare??0),0),s=a.some(e=>e.durationShare!=null),l=i?.get(r)??null,u=l==null?[]:kt(n,l);return{id:t.id,type:`segmentGroup`,position:t.position,draggable:!1,selectable:!1,focusable:!1,zIndex:wt,style:{width:t.width,height:t.height},measured:{width:t.width,height:t.height},data:{width:t.width,height:t.height,stageId:l,durationLabel:s?ue(o):null,findings:u}}}),_=new Set(g.map(e=>e.data.stageId).filter(e=>e!=null)),v=l?(()=>{let e={paddingX:32,paddingY:64,headerHeight:0},t=J(u,[d,m],e),i=`stage-${r}`;if(kt(n,r).length>0&&!t.some(e=>e.id===i)){let[n]=J(()=>i,[d,m],e);n&&t.push(n)}return t.map(e=>{let t=Number(e.id.replace(`stage-`,``));return{id:e.id,type:`stageGroup`,position:e.position,draggable:!1,selectable:!1,focusable:!1,zIndex:Ct,style:{width:e.width,height:e.height},measured:{width:e.width,height:e.height},data:{width:e.width,height:e.height,stageId:t,findings:kt(n,t),showOwnFindings:!_.has(t),onSelect:()=>s?.(t)}}})})():[],y=o??e.edges,b=y.reduce((e,t)=>Math.max(e,t.shuffleBytes??0),0),x=y.map(e=>e.shuffleBytes?{id:e.id,source:e.source,target:e.target,type:`exchange`,data:{shuffleBytes:e.shuffleBytes,maxShuffleBytes:b}}:{id:e.id,source:e.source,target:e.target});return{flowNodes:[...v,...g,...h],flowEdges:x}},[e,n,r,i,a,o,s]),{ref:T,tick:E}=Ot(),[D,O]=(0,K.useState)(!0),[ee,te]=(0,K.useState)(!0),k=c?S.find(e=>e.id===c&&e.type===`planNode`):void 0,A=S.filter(e=>e.type===`planNode`),j=S.filter(e=>e.type===`stageGroup`&&(e.data.findings?.length??0)>0).sort(ye(e=>e.data.findings??[])),ne=a!=null&&a.size===0&&e.nodes.length>0;return(0,Y.jsx)(h,{children:(0,Y.jsx)(Ve,{children:(0,Y.jsxs)(`div`,{ref:T,className:`flex min-h-0 flex-1`,children:[(0,Y.jsx)(ct,{planNodes:A,problemNodes:j,filterMode:p,onFilterModeChange:m,hiddenCount:g,durationMode:_,onDurationModeChange:v,legendOpen:D,onToggleLegend:()=>O(e=>!e),miniMapOpen:t&&ee,onToggleMiniMap:()=>te(e=>!e)}),(0,Y.jsx)(`div`,{className:`relative min-w-0 flex-1`,onKeyDown:e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest(`.react-flow__node-planNode`)?.getAttribute(`data-id`);t&&(e.preventDefault(),l?.(t))},children:(0,Y.jsxs)(y,{nodes:S,edges:C,nodeTypes:xt,edgeTypes:St,"aria-label":`Plan graph. Operators and the data flowing between them. Tab to move between operators, Enter to open an operator's details.`,fitView:!0,fitViewOptions:$,minZoom:.05,edgesFocusable:!1,onNodeClick:(e,t)=>{t.type===`planNode`&&l?.(t.id)},onPaneClick:()=>l?.(null),children:[(0,Y.jsx)(b,{}),(0,Y.jsx)(Dt,{resizeTick:E,fitSignal:f,centerRequest:d}),ne?(0,Y.jsx)(w,{position:`top-center`,children:(0,Y.jsxs)(`p`,{role:`status`,className:`rounded-md border border-border bg-card px-3 py-2 text-xs text-muted-foreground shadow-sm`,children:[`All `,e.nodes.length,` operators are hidden by the node filter. Change it in Settings to show them.`]})}):null,D?(0,Y.jsx)(w,{position:`bottom-left`,children:(0,Y.jsx)(Ze,{})}):null,t&&ee?(0,Y.jsx)(x,{nodeColor:dt,pannable:!0,zoomable:!0,ariaLabel:`Plan overview. Drag to pan and scroll to zoom the graph.`}):null]})}),k?(0,Y.jsx)(Ye,{node:Et(k),onClose:()=>l?.(null),onJumpToPaired:u}):null]})})})}function jt({open:e,nodeCount:t,onConfirm:n,onCancel:r}){return(0,Y.jsx)(A,{open:e,onOpenChange:e=>{e||r()},children:(0,Y.jsxs)(j,{children:[(0,Y.jsx)(te,{children:(0,Y.jsx)(M,{children:`Expand to full plan?`})}),(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`This plan has `,t,` nodes. Rendering the full graph may take several seconds.`]}),(0,Y.jsxs)(D,{children:[(0,Y.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:`Cancel`}),(0,Y.jsx)(H,{type:`button`,size:`sm`,onClick:n,children:`Expand anyway`})]})]})})}var Mt={io:[`scan`,`exchange`],basic:[`scan`,`exchange`,`join`,`aggregate`,`sort`,`filter`],advanced:null},Nt=300;function Pt(e,t){let n=new Map;for(let t of e){let e=n.get(t.source);e?e.push(t.target):n.set(t.source,[t.target])}let r=new Map;function i(e){let a=r.get(e);if(a)return a;let o=new Set;r.set(e,o);for(let r of n.get(e)??[])if(t.has(r))o.add(r);else for(let e of i(r))o.add(e);return o}let a=new Map;for(let t of e)t.shuffleBytes&&a.set(`${t.source}->${t.target}`,t.shuffleBytes);let o=[];for(let e of t)for(let t of i(e)){let n={id:`${e}=>${t}`,source:e,target:t},r=a.get(`${e}->${t}`);r&&(n.shuffleBytes=r),o.push(n)}return o}function Ft(e,t){try{return Le(e,t)}catch{return null}}var It=new Map;function Lt(e,t,n,r){return`${e??`none`}::${t}::${n}::${r}`}function Rt(){It.clear()}var zt=V.getState().modelResetCount;V.subscribe(e=>{e.modelResetCount!==zt&&(zt=e.modelResetCount,Rt())});function Bt(e,t,n){let r=Lt(n,t.stageId,t.scope,t.durationMode),i=It.get(r);if(i)return i;let a=Ft(e,t);return a&&It.set(r,a),a}function Vt({stageId:e,appModel:t,findings:n,activeFileId:r,onClose:i,initialScope:a}){let{resetToDropZone:o}=ie(),{recentEntries:s,onPickRecent:c,onRemoveRecent:l}=ne(r),[u,d]=(0,K.useState)(`basic`),[f,p]=(0,K.useState)(`exclusive`),[m,h]=(0,K.useState)(a??`segment`),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(a!==`full`),[b,x]=(0,K.useState)(!1),[S,C]=(0,K.useState)(e),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(0),[O,te]=(0,K.useState)({nodeId:null,token:0}),[A,j]=(0,K.useState)(null),M=e=>te(t=>({nodeId:e,token:t.token+1}));(0,K.useEffect)(()=>{T(null)},[S,m,u]);let N=ee(S,t),P=N?Bt(N,{scope:`segment`,stageId:S,appModel:t,findings:n,durationMode:f},r):null,F=P!=null&&P.scope===`full`&&m===`segment`&&P.nodes.length>Nt,I=F&&!b;(0,K.useEffect)(()=>{I&&_(!0)},[I]);let L=N&&(m===`full`||g)?Bt(N,{scope:`full`,stageId:S,appModel:t,findings:n,durationMode:f},r):null,R=!v&&m===`full`&&L!=null&&L.nodes.length>Nt,z=g||R;(0,K.useEffect)(()=>{let e=e=>{e.key!==`Escape`||z||(w?T(null):i())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,z,w]);let B=F||R?null:m===`full`?L:P;(0,K.useEffect)(()=>{A&&m===`full`&&B?.nodes.some(e=>e.id===A)&&(T(A),M(A),j(null))},[A,m,B]);function V(){let e=N?Bt(N,{scope:`full`,stageId:S,appModel:t,findings:n,durationMode:f},r):null;e&&e.nodes.length>Nt?_(!0):(h(`full`),D(e=>e+1))}function ae(){h(`segment`),D(e=>e+1)}function oe(e){if(B?.nodes.some(t=>t.id===e)){T(e),M(e);return}j(e),V()}let U=(0,K.useCallback)(e=>{C(e),h(`segment`),y(!0),x(!1),j(null),D(e=>e+1)},[]);function se(){y(!0),h(`full`),_(!1),D(e=>e+1)}function ce(){_(!1),j(null),R&&(y(!0),h(`segment`),P?.scope===`full`&&x(!0)),I&&x(!0)}function le(e){return i(),c(e)}let{visibleNodeIds:ue,filteredEdges:de,hiddenNodes:fe}=(0,K.useMemo)(()=>{let e=Mt[u],t=new Set;if(B)for(let n of B.nodes)(!e||e.includes(n.category))&&t.add(n.id);return{visibleNodeIds:t,filteredEdges:B?Pt(B.edges,t):[],hiddenNodes:B?B.nodes.filter(e=>!t.has(e.id)):[]}},[B,u]),W=B?.scope===`full`,pe=m===`full`,me=(0,K.useId)(),G=W&&!pe;return(0,Y.jsxs)(`div`,{"data-testid":`dashboard`,className:`flex h-screen flex-col`,style:{paddingRight:`var(--docs-inset, 0px)`},children:[(0,Y.jsx)(k,{onLoadNew:o,recentEntries:s,activeFileId:r,onPickRecent:le,onRemoveRecent:l,leadingContent:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`h1`,{className:`truncate font-heading text-sm font-semibold`,children:[`Plan graph: Stage `,S]}),B&&B.scope===`segment`?(0,Y.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[`Segment `,B.segmentIndex+1,` of `,B.segmentCount]}):null,(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:(0,Y.jsx)(re,{anchor:`#bottleneck-duplicate-plan-subtree`,children:`Plan Advisor docs`})})]}),sectionControls:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5`,children:[(0,Y.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:G,"aria-describedby":G?me:void 0,onClick:W?ae:V,children:W?`Back to segment view`:`Expand to full plan`}),G?(0,Y.jsx)(`p`,{id:me,className:`text-xs text-muted-foreground`,children:`This stage's plan couldn't be scoped to a single segment`}):null]}),(0,Y.jsx)(H,{variant:`ghost`,size:`sm`,onClick:i,children:`Close`})]})}),(0,Y.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:R?null:!N||!B?(0,Y.jsx)(`p`,{role:`alert`,className:`p-6 text-sm text-destructive`,children:F?`This plan has more nodes than the graph view can safely render without expanding. Click "Expand to full plan" to confirm.`:`Couldn't build the plan graph for this stage.`}):(0,Y.jsx)(At,{model:B,visibleNodeIds:ue,visibleEdges:de,showMiniMap:!0,findings:n,stageId:S,segmentStageIds:B.segmentStageIds,onSelectStage:U,selectedNodeId:w,onSelectNode:T,onJumpToPaired:oe,centerRequest:O,fitSignal:E,filterMode:u,onFilterModeChange:d,hiddenCount:fe.length,durationMode:f,onDurationModeChange:p})}),(0,Y.jsx)(jt,{open:z,nodeCount:L?.nodes.length??0,onConfirm:se,onCancel:ce})]})}export{Vt as PlanGraphRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{C as n,S as r,T as i,_ as a,b as o,g as s,h as c,m as l,v as u,w as d,x as f,y as p}from"./react-vendor-D2TLlSzI.js";import{a as m,c as h,d as g,f as _,i as v,l as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E}from"./plan-graph-vendor-B0sEms9Z.js";import{c as D,f as O,i as ee,l as te,n as k,o as A,s as j,t as ne,u as M,w as N}from"./useRecentFiles-0XuhS91q.js";import{$ as P,A as re,At as F,D as I,E as L,F as R,G as z,L as ie,Lt as B,Nt as V,O as ae,P as H,Q as oe,T as U,Tt as se,at as ce,bt as le,dt as ue,et as de,ft as fe,it as W,nt as pe,rt as me,tt as G,ut as he,w as ge,xt as _e,yt as ve}from"./index-pnImGbgQ.js";import{t as ye}from"./impact-sort-DxaUheWV.js";var be={name:`arrow-left-right`,size:24,node:[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]};be.node;var xe=F(be),Se={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};Se.node;var Ce=F(Se),we={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};we.node;var Te=F(we),Ee={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};Ee.node;var De=F(Ee),Oe={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Oe.node;var ke=F(Oe),Ae={name:`timer`,size:24,node:[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]};Ae.node;var je=F(Ae),Me={name:`zoom-out`,size:24,node:[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]};Me.node;var Ne=F(Me),Pe={name:`zoom-in`,size:24,node:[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]};Pe.node;var Fe=F(Pe),K=e(t(),1);function Ie({id:e,sourceNodeId:t,planNode:n,category:r,segmentIndex:i,splitRole:a,durationShare:o,exclusiveDurationShare:s,findings:c}){return{id:e,sourceNodeId:t,label:n.name,category:r,operatorDetail:pe(n.name,n.detail??``),primaryMetric:G(n.metrics),segmentIndex:i,splitRole:a,durationShare:o??null,exclusiveDurationShare:s??null,findings:c,metrics:(n.metrics??[]).map(e=>({name:e.name,value:de(e)})),detailText:n.detail&&n.detail!==n.name?n.detail:``}}function Le(e,t){let{scope:n,stageId:r,appModel:i,findings:a=[],durationMode:o=`exclusive`}=t;if(!e)return{nodes:[],edges:[],segmentIndex:null,segmentCount:0,scope:`full`,segmentStageIds:new Map};let s=i.stages.get(r)?.sqlExecutionId??null,c=s==null?null:i.sql.get(s),{segments:l,segOf:u,segmentTopology:d}=me(e),f=l.filter(Boolean).length,p=c&&s!=null?oe(e,i,c,s,o):null,m=o===`exclusive`?p:c&&s!=null?oe(e,i,c,s,`exclusive`):null,h=new Map,g=c&&s!=null?z(s,i.stages):[];if(g.length){let e=new Map;for(let t of g){let n=i.stages.get(t);n&&e.set(t,{submittedAt:n.submittedAt,completedAt:n.completedAt})}for(let[t,n]of W(l,e,g,d))h.set(t,n)}let _=new Map;if(s!=null){for(let e of a)if(e.executionId===s)for(let t of e.planNodeIds??[]){let n=_.get(t);n?n.push(e):_.set(t,[e])}}let v=[],y=[],b=new Map;ce(e,(e,t)=>{let n=e.id,r=P(e.name),a=u.get(e),o=t?t.id:null,s=e.exchangeRole===`write`&&t?t.id:n,c=Ie({id:n,sourceNodeId:s,planNode:e,category:r,segmentIndex:a,splitRole:e.exchangeRole??null,durationShare:p?.get(e),exclusiveDurationShare:m?.get(e),findings:_.get(n)??[]});if(v.push(c),e.exchangeRole){let t=b.get(s)??{};t[e.exchangeRole]=c,b.set(s,t)}if(o){let t={id:`${o}->${n}`,source:o,target:n};if(e.exchangeRole===`write`){let e=h.get(a),n=e==null?void 0:i.stages.get(e),r=n?.shuffleWriteBytes||n?.shuffleReadBytes;if(r){t.shuffleBytes=r;let e=b.get(s)??{};e.shuffleBytes=r,b.set(s,e)}}y.push(t)}},{dedupe:!0});for(let{read:e,write:t,shuffleBytes:n}of b.values())e&&t&&(e.pairedNodeId=t.id,t.pairedNodeId=e.id),n!=null&&(e&&(e.exchangeShuffleBytes=n),t&&(t.exchangeShuffleBytes=n));if(n===`full`)return{nodes:v,edges:y,segmentIndex:null,segmentCount:f,scope:`full`,segmentStageIds:h};let x=null;for(let[e,t]of h)if(t===r){x=e;break}if(x===null)return{nodes:v,edges:y,segmentIndex:null,segmentCount:f,scope:`full`,segmentStageIds:h};let S=new Set;return{nodes:v.filter(e=>e.segmentIndex===x&&(S.add(e.id),!0)),edges:y.filter(e=>S.has(e.source)&&S.has(e.target)),segmentIndex:x,segmentCount:f,scope:`segment`,segmentStageIds:h}}var Re=24,ze=32;function q(e,t,n={}){let r=new T.graphlib.Graph({compound:!!n.groupOf});r.setGraph({rankdir:`RL`,nodesep:128,ranksep:60,ranker:`tight-tree`}),r.setDefaultEdgeLabel(()=>({}));let i=new Set;if(n.groupOf){for(let t of e){let e=n.groupOf(t);e&&i.add(e)}for(let e of i)r.setNode(e,{})}for(let t of e){r.setNode(t.id,{width:220,height:90});let e=n.groupOf?.(t);e&&r.setParent(t.id,e)}for(let e of t)r.setEdge(e.source,e.target);return T.layout(r),e.map(e=>{let t=r.node(e.id);return{...e,position:{x:t.x-110,y:t.y-45}}})}function Be(e,t,n={}){let r=n.paddingX??Re,i=n.paddingY??Re,a=n.headerHeight??ze,o=new Map;for(let n of e){let e=t(n);if(!e)continue;let r=n.position.x,i=n.position.y,a=r+220,s=i+90,c=o.get(e);c?(c.minX=Math.min(c.minX,r),c.minY=Math.min(c.minY,i),c.maxX=Math.max(c.maxX,a),c.maxY=Math.max(c.maxY,s)):o.set(e,{minX:r,minY:i,maxX:a,maxY:s})}return[...o.entries()].map(([e,t])=>({id:e,position:{x:t.minX-r,y:t.minY-i-a},width:t.maxX-t.minX+r*2,height:t.maxY-t.minY+i*2+a}))}function J(e,t,n={}){let r=new Set,i=[];for(let a of t){let t=t=>{let n=e(t);return n&&!r.has(n)?n:null};for(let e of Be(a,t,n))r.add(e.id),i.push(e)}return i}var Y=S();function Ve({delay:e=0,...t}){return(0,Y.jsx)(p,{"data-slot":`tooltip-provider`,delay:e,...t})}function He({...e}){return(0,Y.jsx)(i,{"data-slot":`tooltip`,...e})}function Ue({...e}){return(0,Y.jsx)(d,{"data-slot":`tooltip-trigger`,...e})}function We({className:e,side:t=`top`,sideOffset:i=4,align:a=`center`,alignOffset:s=0,children:c,...l}){return(0,Y.jsx)(n,{children:(0,Y.jsx)(r,{align:a,alignOffset:s,side:t,sideOffset:i,className:`isolate z-50`,children:(0,Y.jsxs)(f,{"data-slot":`tooltip-content`,className:B(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none`,e),...l,children:[c,(0,Y.jsx)(o,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}function Ge(e){return e==null?null:e>=40?`critical`:e>=15?`warning`:`info`}var X={scan:`⇩`,exchange:`⇄`,join:`⋈`,aggregate:`Σ`,sort:`↕`,filter:`∇`,aqe:`⚙`,boilerplate:`·`,transform:`→`};function Ke(e){return e.find(e=>e.impactBand===`critical`)??e.find(e=>e.impactBand===`warning`)??e[0]}function qe({data:e}){let{label:t,operatorDetail:n,primaryMetric:r,category:i,splitRole:a,durationSharePct:o,findings:s}=e,c=X[i]??X.transform,l=Ge(o);return(0,Y.jsxs)(`div`,{className:`relative flex flex-col overflow-visible rounded-md border border-border bg-card px-3 py-2 text-xs shadow-sm`,style:{width:220,height:90},"data-category":i,children:[(0,Y.jsx)(m,{type:`target`,position:g.Right,className:`opacity-0!`}),(0,Y.jsx)(m,{type:`source`,position:g.Left,className:`opacity-0!`}),s&&s.length>0?(()=>{let e=Ke(s);return(0,Y.jsxs)(He,{children:[(0,Y.jsxs)(Ue,{"data-testid":`node-finding-badge`,className:B(`absolute -right-1 -top-1 flex items-center gap-1 rounded-full bg-card px-1.5 py-0.5 text-[10px] font-medium leading-none shadow-sm ring-1 ring-border`,L[e.impactBand]),children:[(0,Y.jsx)(I,{impactBand:e.impactBand}),ve(e.type),s.length>1?(0,Y.jsx)(`span`,{children:s.length}):null]}),(0,Y.jsx)(We,{className:`max-w-xs`,children:(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1 text-left`,children:s.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(I,{impactBand:e.impactBand}),(0,Y.jsx)(`span`,{children:O(e)})]},e.id??`${e.type}-${t}`))})})]})})():null,a===`read`?(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:`paired: see write half`}):null,o!=null&&l?(0,Y.jsxs)(`div`,{className:`mb-1 flex shrink-0 items-center gap-1.5`,title:`Share of the plan's total stage wall time`,children:[(0,Y.jsxs)(`span`,{className:B(`shrink-0 text-[10px] font-medium tabular-nums`,L[l]),children:[o,`%`]}),(0,Y.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`div`,{"data-testid":`duration-heat-bar-fill`,className:B(`h-full rounded-full`,U[l]),style:{width:`${o>0?Math.max(o,4):0}%`}})}),(0,Y.jsxs)(`span`,{className:`sr-only`,children:[`Duration share `,o,`%, `,l===`critical`?`high`:l===`warning`?`medium`:`low`]})]}):null,(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:c}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-medium`,title:t,children:t})]}),n?(0,Y.jsx)(`p`,{className:`truncate text-muted-foreground`,title:n,children:n}):null,r?(0,Y.jsx)(`p`,{className:`truncate text-muted-foreground`,title:r,children:r}):null]})}var Je={read:`Read half. Consumes the shuffle written by its paired write half.`,write:`Write half. Produces the shuffle its paired read half consumes.`};function Ye({node:e,onClose:t,onJumpToPaired:n}){let r=X[e.category]??X.transform,i=e.findings??[],a=e.metrics??[],o=e.category.charAt(0).toUpperCase()+e.category.slice(1);return(0,Y.jsxs)(`div`,{"data-testid":`plan-node-detail`,role:`dialog`,"aria-label":`Plan node detail: ${e.label}`,className:`flex h-full w-80 shrink-0 flex-col gap-3 overflow-y-auto border-l border-border bg-card p-3 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:r}),(0,Y.jsx)(`span`,{className:`break-words font-medium`,children:e.label})]}),(0,Y.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,"aria-label":`Close node detail`,onClick:t,children:(0,Y.jsx)(_e,{className:`size-4`})})]}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground`,children:[o,` · Segment `,e.segmentIndex+1,e.durationSharePct==null?null:(0,Y.jsxs)(Y.Fragment,{children:[` · `,(0,Y.jsxs)(`span`,{className:`text-foreground`,children:[e.durationSharePct,`%`]}),` of plan stage time`]})]}),e.splitRole?(0,Y.jsxs)(Z,{title:`Exchange`,children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:Je[e.splitRole]}),e.exchangeShuffleBytes==null?e.label.startsWith(`Broadcast`)?(0,Y.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Broadcast, no shuffle`}):null:(0,Y.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`Shuffle written`,` `,(0,Y.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:he(e.exchangeShuffleBytes)})]}),e.pairedNodeId&&n?(0,Y.jsxs)(H,{type:`button`,variant:`outline`,size:`sm`,className:`mt-2 h-7 w-full justify-start gap-1.5`,onClick:()=>n(e.pairedNodeId),children:[(0,Y.jsx)(xe,{className:`size-3.5`,"aria-hidden":`true`}),`Jump to `,e.splitRole===`read`?`write`:`read`,` half`]}):null]}):null,i.length>0?(0,Y.jsx)(Z,{title:`Findings`,children:(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:i.map((e,t)=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-1.5`,children:[(0,Y.jsx)(ae,{type:e.type,impactBand:e.impactBand,docAnchor:e.docAnchor,className:`shrink-0`}),(0,Y.jsx)(`span`,{className:`break-words`,children:O(e)})]},e.id??`${e.type}-${t}`))})}):null,a.length>0?(0,Y.jsx)(Z,{title:`Metrics`,children:(0,Y.jsx)(`dl`,{className:`grid grid-cols-[1fr_auto] gap-x-3 gap-y-1`,children:a.map((e,t)=>(0,Y.jsxs)(`div`,{className:`contents`,children:[(0,Y.jsx)(`dt`,{className:`min-w-0 break-words text-muted-foreground`,children:e.name}),(0,Y.jsx)(`dd`,{className:`text-right font-medium tabular-nums`,children:e.value})]},`${e.name}-${t}`))})}):null,e.detailText?(0,Y.jsx)(Z,{title:`Plan detail`,children:(0,Y.jsx)(`pre`,{"data-testid":`plan-node-detail-text`,className:`max-h-48 overflow-auto whitespace-pre-wrap break-words rounded bg-muted p-2 font-mono text-[11px] leading-snug`,children:e.detailText})}):null]})}function Z({title:e,children:t}){return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-1 font-medium text-muted-foreground`,children:e}),t]})}var Xe=[{category:`scan`,label:`Scan`},{category:`filter`,label:`Filter`},{category:`join`,label:`Join`},{category:`aggregate`,label:`Aggregate`},{category:`sort`,label:`Sort`},{category:`exchange`,label:`Exchange`},{category:`transform`,label:`Transform`}];function Ze(){return(0,Y.jsxs)(`div`,{"data-testid":`plan-graph-legend`,role:`region`,"aria-label":`Plan graph legend`,className:`flex max-w-md flex-col gap-2 rounded-md border border-border bg-card p-3 text-xs shadow-md`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-1 font-medium text-muted-foreground`,children:`Operators`}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:Xe.map(({category:e,label:t})=>(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:X[e]}),t]},e))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-1 font-medium text-muted-foreground`,children:`Duration share`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:B(`h-1.5 w-6 rounded-full`,U.info)}),` low`]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:B(`h-1.5 w-6 rounded-full`,U.warning)}),` medium`]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:B(`h-1.5 w-6 rounded-full`,U.critical)}),` high`]})]})]}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`text-foreground`,children:`Edge thickness`}),` = shuffle bytes moved across an exchange.`]}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground`,children:[`A `,(0,Y.jsx)(`span`,{className:`text-foreground`,children:`segment`}),` box groups one Exchange-bounded stage of the plan; a`,` `,(0,Y.jsx)(`span`,{className:`text-foreground`,children:`stage`}),` box (full-plan view) wraps every segment of one Spark stage.`]})]})}function Qe({...e}){return(0,Y.jsx)(u,{"data-slot":`popover`,...e})}function $e({...e}){return(0,Y.jsx)(a,{"data-slot":`popover-trigger`,...e})}function et({align:e=`center`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=8,className:i,...a}){return(0,Y.jsx)(s,{children:(0,Y.jsx)(c,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,Y.jsx)(l,{"data-slot":`popover-content`,className:B(`z-50 w-72 origin-(--transform-origin) rounded-lg bg-popover p-3 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none`,i),...a})})})}function tt({ariaLabel:e,name:t,options:n,value:r,onChange:i,trailingContent:a}){return(0,Y.jsx)(Ve,{children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,role:`radiogroup`,"aria-label":e,children:[n.map(e=>(0,Y.jsxs)(He,{children:[(0,Y.jsxs)(Ue,{render:(0,Y.jsx)(`label`,{className:`tap-target-comfortable flex min-h-8 items-center gap-1.5 px-1 text-sm`}),children:[(0,Y.jsx)(`input`,{type:`radio`,name:t,value:e.value,checked:r===e.value,onChange:()=>i(e.value)}),e.label]}),(0,Y.jsx)(We,{children:e.description})]},e.value)),a]})})}var nt=[{value:`io`,label:`I/O only`,description:`Show only scan and exchange nodes, where the plan reads or shuffles/broadcasts data.`},{value:`basic`,label:`Basic`,description:`Add join, aggregate, sort, and filter nodes to I/O; hide pass-through and boilerplate operators like Project or WholeStageCodegen.`},{value:`advanced`,label:`Advanced`,description:`Show every operator, including the pass-through and boilerplate nodes the other two modes hide.`}];function rt({mode:e,onChange:t,hiddenCount:n}){return(0,Y.jsx)(tt,{ariaLabel:`Node filter`,name:`plan-graph-filter`,options:nt,value:e,onChange:t,trailingContent:n>0?(0,Y.jsx)(ge,{label:`${n} nodes hidden`,impactBand:`info`}):null})}var it=[{value:`exclusive`,label:`Node only`,description:`Each node's share reflects time spent in that operator alone, excluding its descendants.`},{value:`inclusive`,label:`Node + descendants`,description:`Each node's share adds in every descendant operator's time, so an ancestor's bar reflects its whole subtree.`}];function at({mode:e,onChange:t}){return(0,Y.jsx)(tt,{ariaLabel:`Duration heat bar scope`,name:`plan-graph-duration-mode`,options:it,value:e,onChange:t})}function ot({filterMode:e,onFilterModeChange:t,hiddenCount:n,durationMode:r,onDurationModeChange:i,iconOnly:a=!1}){return(0,Y.jsxs)(Qe,{children:[(0,Y.jsxs)($e,{"aria-label":a?`Settings`:void 0,title:a?`Settings`:void 0,className:B(R({variant:`ghost`,size:a?`icon`:`sm`}),`tap-target-comfortable`,a?void 0:`gap-1.5`),children:[(0,Y.jsx)(ke,{"aria-hidden":`true`}),a?null:`Settings`]}),(0,Y.jsxs)(et,{align:a?`start`:`end`,side:a?`right`:`bottom`,"aria-label":`Plan graph settings`,className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:`Node filter`}),(0,Y.jsx)(rt,{mode:e,onChange:t,hiddenCount:n})]}),(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`h-px bg-border`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:`Duration attribution`}),(0,Y.jsx)(at,{mode:r,onChange:i})]})]})]})}var st=e=>e.data;function ct({planNodes:e,problemNodes:t,filterMode:n,onFilterModeChange:r,hiddenCount:i,durationMode:a,onDurationModeChange:o,legendOpen:s,onToggleLegend:c,miniMapOpen:l,onToggleMiniMap:u}){let{zoomIn:d,zoomOut:f,fitView:p,setCenter:m}=E(),[h,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(null),y=[...e].filter(e=>st(e).durationSharePct!=null).sort((e,t)=>(st(t).durationSharePct??0)-(st(e).durationSharePct??0)),b=e=>{e&&m(e.position.x,e.position.y,{zoom:1,duration:300})},x=(e,t,n)=>{if(e.length===0)return;let r=e[((t?e.findIndex(e=>e.id===t):-1)+1)%e.length];b(r),n(r.id)};return(0,Y.jsxs)(`div`,{className:`flex w-12 shrink-0 flex-col items-center gap-1 border-r border-border bg-card/60 py-2`,children:[(0,Y.jsxs)(lt,{children:[(0,Y.jsx)(Q,{label:`Zoom in`,onClick:()=>d({duration:200}),children:(0,Y.jsx)(Fe,{"aria-hidden":`true`})}),(0,Y.jsx)(Q,{label:`Zoom out`,onClick:()=>f({duration:200}),children:(0,Y.jsx)(Ne,{"aria-hidden":`true`})}),(0,Y.jsx)(Q,{label:`Fit to view`,onClick:()=>p({duration:200}),children:(0,Y.jsx)(De,{"aria-hidden":`true`})})]}),(0,Y.jsx)(ut,{}),(0,Y.jsxs)(lt,{children:[(0,Y.jsx)(Q,{label:`Next worst duration`,disabled:y.length===0,onClick:()=>x(y,h,g),children:(0,Y.jsx)(je,{"aria-hidden":`true`})}),t.length>0?(0,Y.jsx)(Q,{label:`Next problem`,onClick:()=>x(t,_,v),children:(0,Y.jsx)(Ce,{"aria-hidden":`true`})}):null]}),(0,Y.jsx)(ut,{}),(0,Y.jsxs)(lt,{children:[(0,Y.jsx)(ot,{iconOnly:!0,filterMode:n,onFilterModeChange:r,hiddenCount:i,durationMode:a,onDurationModeChange:o}),(0,Y.jsx)(Q,{label:s?`Hide legend`:`Legend`,pressed:s,onClick:c,children:(0,Y.jsx)(se,{"aria-hidden":`true`})}),(0,Y.jsx)(Q,{label:l?`Hide minimap`:`Show minimap`,pressed:l,onClick:u,children:(0,Y.jsx)(Te,{"aria-hidden":`true`})})]})]})}function lt({children:e}){return(0,Y.jsx)(`div`,{className:`flex flex-col items-center gap-1`,children:e})}function ut(){return(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`my-0.5 h-px w-6 bg-border`})}function Q({label:e,onClick:t,disabled:n,pressed:r,children:i}){return(0,Y.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:B(`tap-target-comfortable`,r&&`bg-primary/15 text-primary hover:bg-primary/20 hover:text-primary`),"aria-label":e,title:e,"aria-pressed":r,disabled:n,onClick:t,children:i})}function dt(e){if(e.type!==`planNode`)return`var(--muted)`;let t=e.data.findings??[],n=le(t);return n?N[n]:`var(--plan-aggregate)`}function ft({finding:e,className:t}){let n=fe(e);return(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(ae,{type:e.type,impactBand:e.impactBand,docAnchor:e.docAnchor,className:t}),n?(0,Y.jsx)(`span`,{className:`font-mono text-[10px] leading-none whitespace-nowrap text-muted-foreground`,children:n}):null]})}function pt({data:e}){let{width:t,height:n,stageId:r,durationLabel:i,findings:a}=e;return(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-dashed border-border/70 bg-muted/10 nopan nodrag`,style:{width:t,height:n,pointerEvents:`all`},children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-2 py-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{title:r==null?`This plan segment couldn't be matched to a specific Spark stage`:void 0,children:r==null?`Stage —`:`Stage ${r}`}),(0,Y.jsx)(ge,{label:i??`—`,impactBand:`info`,title:`Approximate share of this stage's wall time`}),a.length>0?(0,Y.jsx)(`div`,{className:`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1`,children:a.map((e,t)=>(0,Y.jsx)(ft,{finding:e,className:`h-4 gap-1 px-1.5 text-xs`},e.id??`${e.type}-${t}`))}):null]})})}function mt({data:e}){let{width:t,height:n,stageId:r,findings:i,showOwnFindings:a=!0,onSelect:o}=e;return(0,Y.jsxs)(`div`,{className:`relative rounded-xl border border-primary/25 bg-primary/5 nopan nodrag`,style:{width:t,height:n,pointerEvents:`all`},children:[(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Focus stage ${r}`,onClick:o,style:{pointerEvents:`auto`},className:`absolute inset-0 size-full cursor-pointer rounded-xl transition-colors hover:border-primary/50 hover:bg-primary/10`}),a&&i.length>0?(0,Y.jsx)(`div`,{className:`absolute left-2 right-2 top-1 flex flex-wrap gap-1`,children:i.map((e,t)=>(0,Y.jsx)(ft,{finding:e,className:`h-4 gap-1 px-1.5 text-xs`},e.id??`${e.type}-${t}`))}):null,(0,Y.jsxs)(`span`,{className:`absolute right-2 bottom-1 text-xs font-medium text-primary`,children:[`Stage `,r]})]})}var ht=1.5,gt=.55;function _t(e,t){return!(e>0)||!(t>0)?0:Math.min(1,Math.log(e+1)/Math.log(t+1))}function vt(e,t){return ht+7.5*_t(e,t)}function yt(e,t){return gt+.44999999999999996*_t(e,t)}function bt({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i,targetPosition:a,markerEnd:o,data:s}){let[c,l,u]=_({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i,targetPosition:a}),{shuffleBytes:d=0,maxShuffleBytes:f=0}=s??{},p=vt(d,f),m=yt(d,f),h=d>0&&d<1e3?`<1 KB`:he(d);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(C,{path:c,markerEnd:o,style:{stroke:`var(--text-muted)`,strokeWidth:p,strokeOpacity:m}}),(0,Y.jsx)(v,{children:(0,Y.jsxs)(He,{children:[(0,Y.jsx)(Ue,{"data-testid":`exchange-edge-label`,className:`nodrag nopan pointer-events-auto absolute cursor-help rounded bg-card/90 px-1 py-0.5 font-mono text-[10px] leading-none text-muted-foreground ring-1 ring-border`,style:{transform:`translate(-50%, -50%) translate(${l}px, ${u}px)`},children:h}),(0,Y.jsx)(We,{className:`max-w-xs`,children:(0,Y.jsxs)(`p`,{children:[h,` of shuffle written across this exchange. Edge thickness scales with the volume moved.`]})})]})})]})}var xt={planNode:qe,segmentGroup:pt,stageGroup:mt},St={exchange:bt},Ct=1,wt=2,Tt=3,Et=e=>e.data,$={padding:.06,maxZoom:1.75};function Dt({resizeTick:e,fitSignal:t,centerRequest:n}){let{fitView:r,setCenter:i,getNode:a}=E();return(0,K.useEffect)(()=>{if(!n||n.token===0||!n.nodeId)return;let e=a(n.nodeId);e?i(e.position.x,e.position.y,{zoom:1,duration:300}):r({nodes:[{id:n.nodeId}],duration:300,maxZoom:1})},[n,i,a,r]),(0,K.useEffect)(()=>{let e=()=>r({duration:200,...$});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[r]),(0,K.useEffect)(()=>{e!==0&&r({duration:200,...$})},[e,r]),(0,K.useEffect)(()=>{t!==0&&r({duration:300,...$})},[t,r]),null}function Ot(){let e=(0,K.useRef)(null),[t,n]=(0,K.useState)(0);return(0,K.useEffect)(()=>{let t=e.current;if(!t)return;let r=!0,i=new ResizeObserver(()=>{if(r){r=!1;return}n(e=>e+1)});return i.observe(t),()=>i.disconnect()},[]),{ref:e,tick:t}}function kt(e,t){return e.filter(e=>e.stageId===t||e.stageIds?.includes(t))}function At({model:e,showMiniMap:t,findings:n=[],stageId:r,segmentStageIds:i,visibleNodeIds:a,visibleEdges:o,onSelectStage:s,selectedNodeId:c=null,onSelectNode:l,onJumpToPaired:u,centerRequest:d,fitSignal:f=0,filterMode:p=`basic`,onFilterModeChange:m=()=>{},hiddenCount:g=0,durationMode:_=`exclusive`,onDurationModeChange:v=()=>{}}){let{flowNodes:S,flowEdges:C}=(0,K.useMemo)(()=>{let t=e.nodes.reduce((e,t)=>e+(t.exclusiveDurationShare??t.durationShare??0),0),c=e=>`segment-${e.segmentIndex}`,l=e.scope===`full`,u=e=>{let t=i?.get(e.segmentIndex);return t==null?null:`stage-${t}`},d=a?q(e.nodes.filter(e=>a.has(e.id)),o??e.edges,{groupOf:c}):q(e.nodes,e.edges,{groupOf:c}),f=new Set(d.map(c)),p=l?new Set(d.map(u).filter(e=>e!=null)):null,m=e.nodes.some(e=>!f.has(c(e)))||p!=null&&e.nodes.some(e=>{let t=u(e);return t!=null&&!p.has(t)})?q(e.nodes,e.edges,{groupOf:c}):d,h=d.map(e=>{let n=e.durationShare!=null&&t>0?Math.round(e.durationShare/t*100):null,r=e.splitRole===`read`?`${e.label}, paired: see write half`:[e.label,e.operatorDetail,e.primaryMetric,n==null?null:`${n}% of the plan's total stage duration`].filter(Boolean).join(`, `);return{id:e.id,type:`planNode`,position:e.position,draggable:!1,zIndex:Tt,measured:{width:220,height:90},ariaLabel:r,ariaRole:`button`,data:{...e,durationSharePct:n}}}),g=J(c,[d,m]).map(t=>{let r=Number(t.id.replace(`segment-`,``)),a=e.nodes.filter(e=>c(e)===t.id),o=a.reduce((e,t)=>e+(t.exclusiveDurationShare??t.durationShare??0),0),s=a.some(e=>e.durationShare!=null),l=i?.get(r)??null,u=l==null?[]:kt(n,l);return{id:t.id,type:`segmentGroup`,position:t.position,draggable:!1,selectable:!1,focusable:!1,zIndex:wt,style:{width:t.width,height:t.height},measured:{width:t.width,height:t.height},data:{width:t.width,height:t.height,stageId:l,durationLabel:s?ue(o):null,findings:u}}}),_=new Set(g.map(e=>e.data.stageId).filter(e=>e!=null)),v=l?(()=>{let e={paddingX:32,paddingY:64,headerHeight:0},t=J(u,[d,m],e),i=`stage-${r}`;if(kt(n,r).length>0&&!t.some(e=>e.id===i)){let[n]=J(()=>i,[d,m],e);n&&t.push(n)}return t.map(e=>{let t=Number(e.id.replace(`stage-`,``));return{id:e.id,type:`stageGroup`,position:e.position,draggable:!1,selectable:!1,focusable:!1,zIndex:Ct,style:{width:e.width,height:e.height},measured:{width:e.width,height:e.height},data:{width:e.width,height:e.height,stageId:t,findings:kt(n,t),showOwnFindings:!_.has(t),onSelect:()=>s?.(t)}}})})():[],y=o??e.edges,b=y.reduce((e,t)=>Math.max(e,t.shuffleBytes??0),0),x=y.map(e=>e.shuffleBytes?{id:e.id,source:e.source,target:e.target,type:`exchange`,data:{shuffleBytes:e.shuffleBytes,maxShuffleBytes:b}}:{id:e.id,source:e.source,target:e.target});return{flowNodes:[...v,...g,...h],flowEdges:x}},[e,n,r,i,a,o,s]),{ref:T,tick:E}=Ot(),[D,O]=(0,K.useState)(!0),[ee,te]=(0,K.useState)(!0),k=c?S.find(e=>e.id===c&&e.type===`planNode`):void 0,A=S.filter(e=>e.type===`planNode`),j=S.filter(e=>e.type===`stageGroup`&&(e.data.findings?.length??0)>0).sort(ye(e=>e.data.findings??[])),ne=a!=null&&a.size===0&&e.nodes.length>0;return(0,Y.jsx)(h,{children:(0,Y.jsx)(Ve,{children:(0,Y.jsxs)(`div`,{ref:T,className:`flex min-h-0 flex-1`,children:[(0,Y.jsx)(ct,{planNodes:A,problemNodes:j,filterMode:p,onFilterModeChange:m,hiddenCount:g,durationMode:_,onDurationModeChange:v,legendOpen:D,onToggleLegend:()=>O(e=>!e),miniMapOpen:t&&ee,onToggleMiniMap:()=>te(e=>!e)}),(0,Y.jsx)(`div`,{className:`relative min-w-0 flex-1`,onKeyDown:e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest(`.react-flow__node-planNode`)?.getAttribute(`data-id`);t&&(e.preventDefault(),l?.(t))},children:(0,Y.jsxs)(y,{nodes:S,edges:C,nodeTypes:xt,edgeTypes:St,"aria-label":`Plan graph. Operators and the data flowing between them. Tab to move between operators, Enter to open an operator's details.`,fitView:!0,fitViewOptions:$,minZoom:.05,edgesFocusable:!1,onNodeClick:(e,t)=>{t.type===`planNode`&&l?.(t.id)},onPaneClick:()=>l?.(null),children:[(0,Y.jsx)(b,{}),(0,Y.jsx)(Dt,{resizeTick:E,fitSignal:f,centerRequest:d}),ne?(0,Y.jsx)(w,{position:`top-center`,children:(0,Y.jsxs)(`p`,{role:`status`,className:`rounded-md border border-border bg-card px-3 py-2 text-xs text-muted-foreground shadow-sm`,children:[`All `,e.nodes.length,` operators are hidden by the node filter. Change it in Settings to show them.`]})}):null,D?(0,Y.jsx)(w,{position:`bottom-left`,children:(0,Y.jsx)(Ze,{})}):null,t&&ee?(0,Y.jsx)(x,{nodeColor:dt,pannable:!0,zoomable:!0,ariaLabel:`Plan overview. Drag to pan and scroll to zoom the graph.`}):null]})}),k?(0,Y.jsx)(Ye,{node:Et(k),onClose:()=>l?.(null),onJumpToPaired:u}):null]})})})}function jt({open:e,nodeCount:t,onConfirm:n,onCancel:r}){return(0,Y.jsx)(A,{open:e,onOpenChange:e=>{e||r()},children:(0,Y.jsxs)(j,{children:[(0,Y.jsx)(te,{children:(0,Y.jsx)(M,{children:`Expand to full plan?`})}),(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`This plan has `,t,` nodes. Rendering the full graph may take several seconds.`]}),(0,Y.jsxs)(D,{children:[(0,Y.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:`Cancel`}),(0,Y.jsx)(H,{type:`button`,size:`sm`,onClick:n,children:`Expand anyway`})]})]})})}var Mt={io:[`scan`,`exchange`],basic:[`scan`,`exchange`,`join`,`aggregate`,`sort`,`filter`],advanced:null},Nt=300;function Pt(e,t){let n=new Map;for(let t of e){let e=n.get(t.source);e?e.push(t.target):n.set(t.source,[t.target])}let r=new Map;function i(e){let a=r.get(e);if(a)return a;let o=new Set;r.set(e,o);for(let r of n.get(e)??[])if(t.has(r))o.add(r);else for(let e of i(r))o.add(e);return o}let a=new Map;for(let t of e)t.shuffleBytes&&a.set(`${t.source}->${t.target}`,t.shuffleBytes);let o=[];for(let e of t)for(let t of i(e)){let n={id:`${e}=>${t}`,source:e,target:t},r=a.get(`${e}->${t}`);r&&(n.shuffleBytes=r),o.push(n)}return o}function Ft(e,t){try{return Le(e,t)}catch{return null}}var It=new Map;function Lt(e,t,n,r){return`${e??`none`}::${t}::${n}::${r}`}function Rt(){It.clear()}var zt=V.getState().modelResetCount;V.subscribe(e=>{e.modelResetCount!==zt&&(zt=e.modelResetCount,Rt())});function Bt(e,t,n){let r=Lt(n,t.stageId,t.scope,t.durationMode),i=It.get(r);if(i)return i;let a=Ft(e,t);return a&&It.set(r,a),a}function Vt({stageId:e,appModel:t,findings:n,activeFileId:r,onClose:i,initialScope:a}){let{resetToDropZone:o}=ie(),{recentEntries:s,onPickRecent:c,onRemoveRecent:l}=ne(r),[u,d]=(0,K.useState)(`basic`),[f,p]=(0,K.useState)(`exclusive`),[m,h]=(0,K.useState)(a??`segment`),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(a!==`full`),[b,x]=(0,K.useState)(!1),[S,C]=(0,K.useState)(e),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(0),[O,te]=(0,K.useState)({nodeId:null,token:0}),[A,j]=(0,K.useState)(null),M=e=>te(t=>({nodeId:e,token:t.token+1}));(0,K.useEffect)(()=>{T(null)},[S,m,u]);let N=ee(S,t),P=N?Bt(N,{scope:`segment`,stageId:S,appModel:t,findings:n,durationMode:f},r):null,F=P!=null&&P.scope===`full`&&m===`segment`&&P.nodes.length>Nt,I=F&&!b;(0,K.useEffect)(()=>{I&&_(!0)},[I]);let L=N&&(m===`full`||g)?Bt(N,{scope:`full`,stageId:S,appModel:t,findings:n,durationMode:f},r):null,R=!v&&m===`full`&&L!=null&&L.nodes.length>Nt,z=g||R;(0,K.useEffect)(()=>{let e=e=>{e.key!==`Escape`||z||(w?T(null):i())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,z,w]);let B=F||R?null:m===`full`?L:P;(0,K.useEffect)(()=>{A&&m===`full`&&B?.nodes.some(e=>e.id===A)&&(T(A),M(A),j(null))},[A,m,B]);function V(){let e=N?Bt(N,{scope:`full`,stageId:S,appModel:t,findings:n,durationMode:f},r):null;e&&e.nodes.length>Nt?_(!0):(h(`full`),D(e=>e+1))}function ae(){h(`segment`),D(e=>e+1)}function oe(e){if(B?.nodes.some(t=>t.id===e)){T(e),M(e);return}j(e),V()}let U=(0,K.useCallback)(e=>{C(e),h(`segment`),y(!0),x(!1),j(null),D(e=>e+1)},[]);function se(){y(!0),h(`full`),_(!1),D(e=>e+1)}function ce(){_(!1),j(null),R&&(y(!0),h(`segment`),P?.scope===`full`&&x(!0)),I&&x(!0)}function le(e){return i(),c(e)}let{visibleNodeIds:ue,filteredEdges:de,hiddenNodes:fe}=(0,K.useMemo)(()=>{let e=Mt[u],t=new Set;if(B)for(let n of B.nodes)(!e||e.includes(n.category))&&t.add(n.id);return{visibleNodeIds:t,filteredEdges:B?Pt(B.edges,t):[],hiddenNodes:B?B.nodes.filter(e=>!t.has(e.id)):[]}},[B,u]),W=B?.scope===`full`,pe=m===`full`,me=(0,K.useId)(),G=W&&!pe;return(0,Y.jsxs)(`div`,{"data-testid":`dashboard`,className:`flex h-screen flex-col`,style:{paddingRight:`var(--docs-inset, 0px)`},children:[(0,Y.jsx)(k,{onLoadNew:o,recentEntries:s,activeFileId:r,onPickRecent:le,onRemoveRecent:l,leadingContent:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`h1`,{className:`truncate font-heading text-sm font-semibold`,children:[`Plan graph: Stage `,S]}),B&&B.scope===`segment`?(0,Y.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[`Segment `,B.segmentIndex+1,` of `,B.segmentCount]}):null,(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:(0,Y.jsx)(re,{anchor:`#bottleneck-duplicate-plan-subtree`,children:`Plan Advisor docs`})})]}),sectionControls:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5`,children:[(0,Y.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:G,"aria-describedby":G?me:void 0,onClick:W?ae:V,children:W?`Back to segment view`:`Expand to full plan`}),G?(0,Y.jsx)(`p`,{id:me,className:`text-xs text-muted-foreground`,children:`This stage's plan couldn't be scoped to a single segment`}):null]}),(0,Y.jsx)(H,{variant:`ghost`,size:`sm`,onClick:i,children:`Close`})]})}),(0,Y.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:R?null:!N||!B?(0,Y.jsx)(`p`,{role:`alert`,className:`p-6 text-sm text-destructive`,children:F?`This plan has more nodes than the graph view can safely render without expanding. Click "Expand to full plan" to confirm.`:`Couldn't build the plan graph for this stage.`}):(0,Y.jsx)(At,{model:B,visibleNodeIds:ue,visibleEdges:de,showMiniMap:!0,findings:n,stageId:S,segmentStageIds:B.segmentStageIds,onSelectStage:U,selectedNodeId:w,onSelectNode:T,onJumpToPaired:oe,centerRequest:O,fitSignal:E,filterMode:u,onFilterModeChange:d,hiddenCount:fe.length,durationMode:f,onDurationModeChange:p})}),(0,Y.jsx)(jt,{open:z,nodeCount:L?.nodes.length??0,onConfirm:se,onCancel:ce})]})}export{Vt as PlanGraphRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,bt as a,dt as o,ht as s,i as c,k as l,l as u,ot as d}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,bt as a,dt as o,ht as s,i as c,k as l,l as u,ot as d}from"./index-pnImGbgQ.js";import{t as f}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as p}from"./StagePill-BwwKLcFl.js";import{t as m}from"./ImpactEstimate-Df_laG-n.js";import{t as h}from"./RowPagination-2icPidMP.js";import{r as g}from"./impact-sort-DxaUheWV.js";import{n as _}from"./finding-anchor-CDbHtqKT.js";import{t as v}from"./usePagedRows-jNUWgVTD.js";import{n as y,t as b}from"./useSortMode-DHlKZeWv.js";var x=e(t(),1),S=n();function C(e){return e.stageId!=null}function w(e){return String(e.extended??``).replace(/, wasting \d+s of executor time\./,`.`)}function T(e){let t=String(e.recommendation??``),n=t.indexOf(`: `);return n===-1?t:t.slice(n+2)}function E({finding:e}){let t=_([e]);return(0,S.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`flex flex-col gap-1 transition-colors ${t.flashClassName}`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(p,{stageId:e.stageId}),(0,S.jsx)(r,{impactBand:e.impactBand})]}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Wasted `,(0,S.jsx)(`strong`,{children:o(s(e))}),` of executor time.`,e.extended?(0,S.jsxs)(l,{children:[` `,w(e)]}):null]}),e.recommendation?(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:T(e)}):null,(0,S.jsx)(m,{finding:e})]})}function D({appModel:e,catalog:t,defaultCollapsed:n=!0}){let[r,l]=(0,x.useState)(0),{sortMode:p,setSortMode:m,orderBy:_}=b(),[w,T]=(0,x.useState)(!n),D=u(),O=(0,x.useRef)(!1);(0,x.useEffect)(()=>{if(!O.current){O.current=!0;return}l(0)},[e]);let k=t.filter(C).filter(e=>e.type===`retryWaste`),A=[...k].sort((e,t)=>d[e.impactBand]-d[t.impactBand]||(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0)),j=_(A,e=>[e],e=>e.stageId),M=D?j.findIndex(e=>e===D.finding):null,{totalPages:N,effectivePage:P,visible:F}=v(j,r,l,M);return k.length===0?null:(0,S.jsxs)(c,{title:`Retry Waste`,impactBand:a(k),badges:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(i,{type:`retryWaste`,impactBand:a(k)}),g(k,k.length,w)?(0,S.jsx)(y,{mode:p,onChange:e=>{m(e),l(0)}}):null]}),open:w,onOpenChange:T,summary:(0,S.jsx)(f,{value:o(s(A[0])),context:`${k.length} item${k.length===1?``:`s`} flagged`}),children:[(0,S.jsx)(`ul`,{className:`space-y-3`,children:F.map(e=>(0,S.jsx)(E,{finding:e},e.id))}),(0,S.jsx)(h,{page:P,totalPages:N,onPrev:()=>l(e=>e-1),onNext:()=>l(e=>e+1)})]})}export{D as RetryWaste};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{P as t}from"./index-
|
|
1
|
+
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{P as t}from"./index-pnImGbgQ.js";var n=e();function r({page:e,totalPages:r,onPrev:i,onNext:a,renderJumpControl:o}){return r<=1?null:(0,n.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs ${o?`justify-between`:`justify-end`}`,children:[o?.(),(0,n.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,n.jsx)(t,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable tap-target-comfortable--sm`,onClick:i,disabled:e===0,children:`Previous`}),(0,n.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Page `,e+1,` of `,r]}),(0,n.jsx)(t,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable tap-target-comfortable--sm`,onClick:a,disabled:e===r-1,children:`Next`})]})]})}export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{i as r}from"./useRecentFiles-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{i as r}from"./useRecentFiles-0XuhS91q.js";import{Ft as i,O as a,_t as o,bt as s,ht as c,i as l,l as u,ot as d,ut as f}from"./index-pnImGbgQ.js";import{t as p}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as m}from"./StagePill-BwwKLcFl.js";import{t as h}from"./ImpactEstimate-Df_laG-n.js";import{t as g}from"./RowPagination-2icPidMP.js";import{r as _}from"./impact-sort-DxaUheWV.js";import{n as v,t as y}from"./finding-anchor-CDbHtqKT.js";import{t as b}from"./usePagedRows-jNUWgVTD.js";import{n as x,t as S}from"./useSortMode-DHlKZeWv.js";import{t as C}from"./StageHeader-CGeWqC-0.js";import{a as w,i as T,n as E,r as D,t as O}from"./select-C-MZGNpb.js";import{t as k}from"./PlanExplorer-DjGTZifP.js";var A=e(t(),1),j=n();function M({entry:e,appModel:t}){let n=i(),a=v([e.shuffle]),s=t.stages.get(e.stageId),l=s?o(s):null,u=n===`advanced`&&r(e.stageId,t);return(0,j.jsxs)(`div`,{ref:a.ref,tabIndex:a.tabIndex,"data-flashed":a.dataFlashed,className:`space-y-2 ${y} transition-colors ${a.flashClassName}`,children:[(0,j.jsx)(C,{stageId:e.stageId,appModel:t}),(0,j.jsxs)(`p`,{className:`text-sm`,children:[`Shuffle read: `,(0,j.jsx)(`strong`,{children:f(c(e.shuffle))}),` · `,`Write: `,f(s?.shuffleWriteBytes??0)]}),(0,j.jsx)(h,{finding:e.shuffle}),l||u?(0,j.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[l?(0,j.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Try `,(0,j.jsxs)(`code`,{children:[`spark.sql.shuffle.partitions = `,l.recommended]}),`: current`,` `,l.current,` tasks, target 128 MB per partition`]}):null,u?(0,j.jsx)(k,{stageId:e.stageId,appModel:t}):null]}):null]})}var N=(0,A.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let[r,i]=(0,A.useState)(0),[o,h]=(0,A.useState)(!n),{sortMode:v,setSortMode:y,orderBy:C}=S(),k=u(),{shuffleFindings:N,sorted:P,orderedEntries:F}=(0,A.useMemo)(()=>{let e=t.filter(e=>e.type===`shuffle`),n=[...e.filter(e=>e.stageId!=null).map(e=>({stageId:e.stageId,shuffle:e,impactBand:e.impactBand,peak:c(e)}))].sort((e,t)=>d[e.impactBand]-d[t.impactBand]||t.peak-e.peak);return{shuffleFindings:e,sorted:n,orderedEntries:C(n,e=>[e.shuffle],e=>e.stageId)}},[t,v]),I=k?F.findIndex(e=>e.shuffle===k.finding):null,{totalPages:L,effectivePage:R,visible:z}=b(F,r,i,I);if(N.length===0){let t=0;for(let n of e.stages.values())t=Math.max(t,n.shuffleReadBytes??0);return(0,j.jsx)(l,{title:`Shuffle I/O`,open:o,onOpenChange:h,summary:(0,j.jsx)(p,{value:f(t),context:`no issue detected: peak shuffle read`}),children:(0,j.jsx)(`div`,{className:`flex flex-col gap-1`,children:(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No shuffle read/write issues detected.`})})})}let B=s(N),V=F.map(e=>({id:e.stageId})),H=_(N,P.length,o);return(0,j.jsx)(l,{title:`Shuffle I/O`,impactBand:B,open:o,onOpenChange:h,summary:(0,j.jsx)(p,{value:f(P[0].peak),context:`Peak shuffle read · ${P.length} stage${P.length===1?``:`s`} flagged`}),badges:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(a,{type:`shuffle`,impactBand:B??`info`}),H?(0,j.jsx)(x,{mode:v,onChange:e=>{y(e),i(0)}}):null]}),children:(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsx)(m,{pills:V}),z.map(t=>(0,j.jsx)(M,{entry:t,appModel:e},t.stageId)),(0,j.jsx)(g,{page:R,totalPages:L,onPrev:()=>i(e=>e-1),onNext:()=>i(e=>e+1),renderJumpControl:()=>(0,j.jsxs)(O,{value:String(R*6),onValueChange:e=>i(Math.floor(Number(e)/6)),children:[(0,j.jsx)(T,{size:`sm`,"aria-label":`Jump to stage`,children:(0,j.jsx)(w,{placeholder:`Jump to stage`})}),(0,j.jsx)(E,{children:F.map((e,t)=>(0,j.jsxs)(D,{value:String(t),children:[`Stage `,e.stageId,` (`,f(e.peak),`)`]},e.stageId))})]})})]})})});export{N as ShuffleIO};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{ht as r,pt as i}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{ht as r,pt as i}from"./index-pnImGbgQ.js";import{t as a}from"./StageFindingGroup-R4OW-g4U.js";var o=e(t(),1),s=n();function c(e){return`${e.metric}: ${i(`ratio`,r(e))}`}var l=(0,o.memo)(function(e){return(0,s.jsx)(a,{...e,type:`skew`,title:`Task Skew`,idPrefix:`skew`,findingLabel:c})});export{l as Skew};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,ht as a,i as o,l as s,ot as c,pt as l}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,ht as a,i as o,l as s,ot as c,pt as l}from"./index-pnImGbgQ.js";import{t as u}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as d}from"./ImpactEstimate-Df_laG-n.js";import{t as f}from"./RowPagination-2icPidMP.js";import{r as p}from"./impact-sort-DxaUheWV.js";import{n as m}from"./finding-anchor-CDbHtqKT.js";import{t as h}from"./usePagedRows-jNUWgVTD.js";import{n as g,t as _}from"./useSortMode-DHlKZeWv.js";import{t as v}from"./StageHeader-CGeWqC-0.js";var y=e(t(),1),b=n();function x(e){let t=a(e);if(e.metric===`execMaxMedianRatio`)return`Executor ${e.executorId}: ${l(`ratio`,t)} median on ${e.dimension??`this metric`}`;let n=Math.round((e.hostTaskShare??0)*100);return e.metric===`hostDurationShare`?`${e.host}: ${l(`pctFraction`,t)} of this stage's task time (${l(`pct`,n)} of tasks)`:`${e.host}: ${l(`ratio`,t)} median task time (${l(`pct`,n)} of tasks)`}function S(e){if(e.metric!==`hostDurationShare`&&e.metric!==`execMaxMedianRatio`)return null;let t=e.recommendation??``,n=t.indexOf(`: `);return n===-1?null:t.slice(n)}function C({finding:e,appModel:t}){let n=m([e]),i=S(e);return(0,b.jsxs)(`li`,{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-1 text-sm transition-colors ${n.flashClassName}`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(r,{impactBand:e.impactBand}),e.stageId==null?null:(0,b.jsx)(v,{stageId:e.stageId,appModel:t})]}),(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[x(e),i]}),(0,b.jsx)(d,{finding:e}),i==null?(0,b.jsx)(`p`,{className:`text-muted-foreground pt-1`,children:e.recommendation}):null]})}var w=(0,y.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let{sortMode:r,setSortMode:a,orderBy:l}=_(),[d,m]=(0,y.useState)(!n),[v,S]=(0,y.useState)(0),w=t.filter(e=>e.type===`slowHost`).slice().sort((e,t)=>c[e.impactBand]-c[t.impactBand]),T=l(w,e=>[e],e=>e.stageId??null),E=s(),D=E?T.findIndex(e=>e===E.finding):null,{totalPages:O,effectivePage:k,visible:A}=h(T,v,S,D);return w.length===0?null:(0,b.jsxs)(o,{title:`Slow Executor Host`,impactBand:w[0].impactBand,badges:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i,{type:`slowHost`,impactBand:w[0].impactBand}),p(w,w.length,d)?(0,b.jsx)(g,{mode:r,onChange:a}):null]}),open:d,onOpenChange:m,summary:(0,b.jsx)(u,{value:x(w[0]),context:`${w.length} issue${w.length===1?``:`s`} flagged`}),children:[(0,b.jsx)(`ul`,{className:`space-y-2`,children:A.map(t=>(0,b.jsx)(C,{finding:t,appModel:e},t.id))}),(0,b.jsx)(f,{page:k,totalPages:O,onPrev:()=>S(e=>e-1),onNext:()=>S(e=>e+1)})]})});export{w as SlowHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-0XuhS91q.js";import{O as i,bt as a,i as o,k as s,l as c,ot as l,r as u}from"./index-pnImGbgQ.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as f}from"./StagePill-BwwKLcFl.js";import{t as p}from"./ImpactEstimate-Df_laG-n.js";import{t as m}from"./RowPagination-2icPidMP.js";import{i as h,r as g}from"./impact-sort-DxaUheWV.js";import{n as _,t as v}from"./finding-anchor-CDbHtqKT.js";import{t as y}from"./usePagedRows-jNUWgVTD.js";import{n as b,t as x}from"./useSortMode-DHlKZeWv.js";var S=e(t(),1),C=n();function w({finding:e}){let t=_([e]);return(0,C.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-2 ${v} transition-colors ${t.flashClassName}`,children:[e.stageIds&&e.stageIds.length>0?(0,C.jsx)(f,{pills:e.stageIds.map(e=>({id:e}))}):null,(0,C.jsxs)(`p`,{children:[e.recommendation,` `,(0,C.jsx)(p,{finding:e})]})]})}var T=(0,S.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:f,orderBy:p}=x(),[_,v]=(0,S.useState)(!t),[T,E]=(0,S.useState)(0),{findings:D,pills:O}=(0,S.useMemo)(()=>{let t=e.filter(e=>e.type===`smallFiles`).sort((e,t)=>l[e.impactBand]-l[t.impactBand]);return{findings:t,pills:[...new Set(t.flatMap(e=>e.stageIds??[]))].map(e=>({id:e}))}},[e,n]),k=p(D,e=>[e],h),A=c(),j=A?k.findIndex(e=>e===A.finding):null,{totalPages:M,effectivePage:N,visible:P}=y(k,T,E,j);return D.length===0?null:(0,C.jsxs)(o,{title:`Excessive Small Files`,impactBand:a(D),open:_,onOpenChange:v,badges:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(i,{type:`smallFiles`,impactBand:a(D)??`info`,className:u}),g(D,D.length,_)?(0,C.jsx)(b,{mode:n,onChange:f}):null]}),statusBadge:(0,C.jsx)(s,{children:(0,C.jsx)(r,{confidence:D[0].confidence,validationRequired:D[0].validationRequired,evidenceKey:`sqlPlan`})}),summary:(0,C.jsx)(d,{value:`${O.length} stage${O.length===1?``:`s`}`,context:`${D.length} finding${D.length===1?``:`s`} flagged`}),children:[(0,C.jsx)(`ul`,{className:`space-y-3 text-sm`,children:P.map(e=>(0,C.jsx)(w,{finding:e},e.id))}),(0,C.jsx)(m,{page:N,totalPages:M,onPrev:()=>E(e=>e-1),onNext:()=>E(e=>e+1)})]})});export{T as SmallFiles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,dt as a,ht as o,i as s,l as c,ot as l}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,dt as a,ht as o,i as s,l as c,ot as l}from"./index-pnImGbgQ.js";import{t as u}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as d}from"./ImpactEstimate-Df_laG-n.js";import{t as f}from"./RowPagination-2icPidMP.js";import{r as p}from"./impact-sort-DxaUheWV.js";import{n as m}from"./finding-anchor-CDbHtqKT.js";import{t as h}from"./usePagedRows-jNUWgVTD.js";import{n as g,t as _}from"./useSortMode-DHlKZeWv.js";import{t as v}from"./StageHeader-CGeWqC-0.js";var y=e(t(),1),b=n();function x(e){return a(o(e))}function S({finding:e,appModel:t}){let n=m([e]);return(0,b.jsxs)(`li`,{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-1 text-sm transition-colors ${n.flashClassName}`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(r,{impactBand:e.impactBand}),e.stageId==null?null:(0,b.jsx)(v,{stageId:e.stageId,appModel:t}),(0,b.jsx)(`strong`,{children:x(e)})]}),(0,b.jsx)(d,{finding:e}),(0,b.jsx)(`p`,{className:`text-muted-foreground pt-1`,children:e.recommendation})]})}var C=(0,y.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let{sortMode:r,setSortMode:a,orderBy:o}=_(),[d,m]=(0,y.useState)(!n),[v,C]=(0,y.useState)(0),w=t.filter(e=>e.type===`speculationWaste`).slice().sort((e,t)=>l[e.impactBand]-l[t.impactBand]),T=o(w,e=>[e],e=>e.stageId??null),E=c(),D=E?T.findIndex(e=>e===E.finding):null,{totalPages:O,effectivePage:k,visible:A}=h(T,v,C,D);return w.length===0?null:(0,b.jsxs)(s,{title:`Speculation Waste`,impactBand:w[0].impactBand,badges:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i,{type:`speculationWaste`,impactBand:w[0].impactBand}),p(w,w.length,d)?(0,b.jsx)(g,{mode:r,onChange:a}):null]}),open:d,onOpenChange:m,summary:(0,b.jsx)(u,{value:x(w[0]),context:`${w.length} issue${w.length===1?``:`s`} flagged`}),children:[(0,b.jsx)(`ul`,{className:`space-y-2`,children:A.map(t=>(0,b.jsx)(S,{finding:t,appModel:e},t.id))}),(0,b.jsx)(f,{page:k,totalPages:O,onPrev:()=>C(e=>e-1),onNext:()=>C(e=>e+1)})]})});export{C as SpeculationWaste};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t,_ as n,c as r,d as i,f as a,l as o,o as s,r as c,s as l,t as u,v as d}from"./charts-vendor-0VMaLVLN.js";import{p as f}from"./plan-graph-vendor-B0sEms9Z.js";import{B as p,R as m,S as h,T as g,V as _,i as v,w as y,z as b}from"./useRecentFiles-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t,_ as n,c as r,d as i,f as a,l as o,o as s,r as c,s as l,t as u,v as d}from"./charts-vendor-0VMaLVLN.js";import{p as f}from"./plan-graph-vendor-B0sEms9Z.js";import{B as p,R as m,S as h,T as g,V as _,i as v,w as y,z as b}from"./useRecentFiles-0XuhS91q.js";import{A as x,D as S,Dt as C,Ft as w,O as T,_t as E,ct as D,ht as O,i as k,k as A,l as ee,ot as j,st as M,ut as N,w as P}from"./index-pnImGbgQ.js";import{t as F}from"./EmptyState-DqnSxTjJ.js";import{t as I}from"./downsample-WmNM1qc9.js";import{t as L}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as R}from"./StagePill-BwwKLcFl.js";import{t as z}from"./ImpactEstimate-Df_laG-n.js";import{t as B}from"./RowPagination-2icPidMP.js";import{r as V}from"./impact-sort-DxaUheWV.js";import{n as H,t as U}from"./finding-anchor-CDbHtqKT.js";import{t as W}from"./usePagedRows-jNUWgVTD.js";import{n as G,t as K}from"./useSortMode-DHlKZeWv.js";import{t as q}from"./PlanExplorer-DjGTZifP.js";var J=e(t(),1),Y=f(),X=240,Z=524288e3,Q=10;function $(e){let t=e.spillBytes>Z,n=e.gcPct>Q;return t&&n?`critical`:t||n?`warning`:`info`}function te(e){return y[$(e)]}function ne({active:e,payload:t}){if(!e||!t?.length)return null;let n=t[0]?.payload;if(!n)return null;let r=$(n);return(0,Y.jsxs)(`div`,{className:`rounded-md border border-border bg-popover px-2 py-1.5 text-xs text-popover-foreground shadow-md`,children:[(0,Y.jsxs)(`p`,{children:[N(n.spillBytes),` spilled`]}),(0,Y.jsxs)(`p`,{children:[n.gcPct.toFixed(1),`% GC`]}),(0,Y.jsxs)(`p`,{className:`mt-1 flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(S,{impactBand:r}),r.toUpperCase()]})]})}function re({appModel:e}){let t=[];for(let n of e.stages.values()){let e=n.memoryBytesSpilled??0;e<=0||t.push({stageId:n.id,spillBytes:e,gcPct:n.gcPct??0,submittedAt:n.submittedAt??0})}if(t.length===0)return(0,Y.jsx)(F,{tone:`clean`,icon:C,title:`No stages spilled memory in this run.`});let f=I(t),h=[...f].sort((e,t)=>e.submittedAt-t.submittedAt).map(e=>({stage:`S${e.stageId}`,spillMB:e.spillBytes/1048576,gcPct:e.gcPct}));return(0,Y.jsxs)(m,{defaultValue:`scatter`,children:[(0,Y.jsxs)(p,{"aria-label":`Memory pressure view`,children:[(0,Y.jsx)(_,{value:`scatter`,children:`Scatter`}),(0,Y.jsx)(_,{value:`twin`,children:`Twin bars`})]}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Spill and GC pressure both stem from tight executor memory, see`,` `,(0,Y.jsx)(x,{anchor:`#memory-model`,children:`how Spark’s memory model works`}),`.`]}),(0,Y.jsxs)(b,{value:`scatter`,children:[(0,Y.jsxs)(`div`,{className:`mb-1 flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(S,{impactBand:`critical`}),`CRITICAL`]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(S,{impactBand:`warning`}),`WARNING`]}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(S,{impactBand:`info`}),`INFO`]})]}),(0,Y.jsx)(g,{ariaLabel:`Memory pressure scatter: spilled memory versus GC percent, one point per stage that spilled.`,height:X,table:{caption:`Memory spilled and GC percent by stage`,columns:[`Stage`,`Memory spilled`,`GC %`],rows:f.map(e=>[`S${e.stageId}`,N(e.spillBytes),`${e.gcPct.toFixed(1)}%`]),align:[`left`,`right`,`right`]},children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(a,{stroke:y.muted,strokeOpacity:.2}),(0,Y.jsx)(l,{type:`number`,dataKey:`spillBytes`,name:`Memory spilled`,tickFormatter:e=>N(e),tick:{fontSize:10}}),(0,Y.jsx)(s,{type:`number`,dataKey:`gcPct`,name:`GC %`,tick:{fontSize:10},width:32}),(0,Y.jsx)(d,{cursor:{strokeDasharray:`3 3`},content:ne}),(0,Y.jsx)(r,{data:f,name:`Spill vs. GC`,children:f.map(e=>(0,Y.jsx)(n,{fill:te(e)},e.stageId))})]})})]}),(0,Y.jsx)(b,{value:`twin`,children:(0,Y.jsx)(g,{ariaLabel:`Memory pressure by stage: spilled memory and GC percent across stages in submission order.`,height:X,table:{caption:`Spilled memory and GC percent by stage, submission order`,columns:[`Stage`,`Spill (MB)`,`GC %`],rows:h.map(e=>[e.stage,e.spillMB.toFixed(1),`${e.gcPct.toFixed(1)}%`]),align:[`left`,`right`,`right`]},children:(0,Y.jsxs)(u,{data:h,children:[(0,Y.jsx)(a,{stroke:y.muted,strokeOpacity:.2}),(0,Y.jsx)(l,{dataKey:`stage`,tick:{fontSize:10}}),(0,Y.jsx)(s,{yAxisId:`left`,tick:{fontSize:10},width:36}),(0,Y.jsx)(s,{yAxisId:`right`,orientation:`right`,tick:{fontSize:10},width:36}),(0,Y.jsx)(d,{}),(0,Y.jsx)(o,{yAxisId:`left`,dataKey:`spillMB`,name:`Spill (MB)`,fill:y.critical}),(0,Y.jsx)(i,{yAxisId:`right`,dataKey:`gcPct`,name:`GC %`,stroke:y.info,dot:!1})]})})})]})}function ie(e,t){return e.stages.get(t)?.spillClassification??`unclassified`}function ae({finding:e,appModel:t}){let n=H([e]),r=w(),i=t.stages.get(e.stageId),a=ie(t,e.stageId),o=a===`volume`&&i?E(i):null,s=r===`advanced`&&v(e.stageId,t);return(0,Y.jsxs)(`div`,{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-2 ${U} transition-colors ${n.flashClassName}`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(S,{impactBand:e.impactBand}),(0,Y.jsx)(P,{label:M[a],impactBand:e.impactBand,title:D[a]}),(0,Y.jsx)(R,{stageId:e.stageId})]}),(0,Y.jsx)(A,{children:(0,Y.jsx)(h,{confidence:e.confidence,validationRequired:e.validationRequired})})]}),(0,Y.jsxs)(`p`,{className:`text-sm`,children:[`Memory spilled: `,(0,Y.jsx)(`strong`,{children:N(O(e))}),` · `,`Disk: `,N(i?.diskBytesSpilled??0)]}),(0,Y.jsx)(z,{finding:e}),o?(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Try: `,(0,Y.jsxs)(`code`,{children:[`spark.sql.shuffle.partitions = `,o.recommended]}),` (current ${o.current} tasks, target 128 MB per partition)`]}):null,e.recommendation?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.recommendation}):null,s?(0,Y.jsx)(`div`,{className:`pt-1`,children:(0,Y.jsx)(q,{stageId:e.stageId,appModel:t})}):null]})}var oe=(0,J.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let{sortMode:r,setSortMode:i,orderBy:a}=K(),[o,s]=(0,J.useState)(!n),[c,l]=(0,J.useState)(0),{findings:u,sorted:d,orderedFindings:f}=(0,J.useMemo)(()=>{let e=t.filter(e=>e.type===`spill`&&e.stageId!=null),n=[...e].sort((e,t)=>(j[e.impactBand]??9)-(j[t.impactBand]??9)||(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0));return{findings:e,sorted:n,orderedFindings:a(n,e=>[e],e=>e.stageId)}},[t,r]),p=ee(),m=p?f.findIndex(e=>e===p.finding):null,{totalPages:h,effectivePage:g,visible:_}=W(f,c,l,m);if(u.length===0){let t=0;for(let n of e.stages.values())t=Math.max(t,n.memoryBytesSpilled??0);return(0,Y.jsx)(k,{title:`Spill: no issue detected (max ${N(t)} spilled)`,children:(0,Y.jsx)(F,{tone:`clean`,icon:C,title:`No stages spilled memory in this run.`})})}let v=d[0].impactBand;return(0,Y.jsx)(k,{title:`Spill`,impactBand:v,badges:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(T,{type:`spill`,impactBand:v}),V(u,d.length,o)?(0,Y.jsx)(G,{mode:r,onChange:i}):null]}),open:o,onOpenChange:s,summary:(0,Y.jsx)(L,{value:N(typeof d[0].value==`number`?d[0].value:0),context:`peak · ${d.length} stage${d.length===1?``:`s`}`}),children:(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(re,{appModel:e}),_.map(t=>(0,Y.jsx)(ae,{finding:t,appModel:e},t.stageId)),(0,Y.jsx)(B,{page:g,totalPages:h,onPrev:()=>l(e=>e-1),onNext:()=>l(e=>e+1)})]})})});export{oe as Spill};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,bt as a,i as o,l as s,ot as c}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,bt as a,i as o,l as s,ot as c}from"./index-pnImGbgQ.js";import{t as l}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as u}from"./StagePill-BwwKLcFl.js";import{t as d}from"./ImpactEstimate-Df_laG-n.js";import{t as f}from"./RowPagination-2icPidMP.js";import{r as p}from"./impact-sort-DxaUheWV.js";import{n as m}from"./finding-anchor-CDbHtqKT.js";import{t as h}from"./usePagedRows-jNUWgVTD.js";import{n as g,t as _}from"./useSortMode-DHlKZeWv.js";var v=e(t(),1),y=n();function b(e){return e.stageId!=null}function x({finding:e}){let t=m([e]);return(0,y.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`flex flex-col gap-1 transition-colors ${t.flashClassName}`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(u,{stageId:e.stageId}),(0,y.jsx)(r,{impactBand:e.impactBand})]}),(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Stage attempt failed outright. Reason: `,(0,y.jsx)(`strong`,{children:String(e.value)})]}),(0,y.jsx)(d,{finding:e}),e.recommendation?(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.recommendation}):null]})}function S({appModel:e,catalog:t,defaultCollapsed:n=!0}){let[r,u]=(0,v.useState)(0),{sortMode:d,setSortMode:m,orderBy:S}=_(),[C,w]=(0,v.useState)(!n),T=s(),E=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(!E.current){E.current=!0;return}u(0)},[e]);let D=t.filter(b).filter(e=>e.type===`stageFailed`),O=S([...D].sort((e,t)=>c[e.impactBand]-c[t.impactBand]||e.stageId-t.stageId),e=>[e],e=>e.stageId),k=T?O.findIndex(e=>e===T.finding):null,{totalPages:A,effectivePage:j,visible:M}=h(O,r,u,k);return D.length===0?null:(0,y.jsxs)(o,{title:`Failed Stages`,impactBand:a(D),badges:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(i,{type:`stageFailed`,impactBand:a(D)}),p(D,D.length,C)?(0,y.jsx)(g,{mode:d,onChange:e=>{m(e),u(0)}}):null]}),open:C,onOpenChange:w,summary:(0,y.jsx)(l,{value:D.length,context:`stage${D.length===1?``:`s`} failed outright`}),children:[(0,y.jsx)(`ul`,{className:`space-y-3`,children:M.map(e=>(0,y.jsx)(x,{finding:e},e.id))}),(0,y.jsx)(f,{page:j,totalPages:A,onPrev:()=>u(e=>e-1),onNext:()=>u(e=>e+1)})]})}export{S as StageFailed};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r,i}from"./useRecentFiles-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r,i}from"./useRecentFiles-0XuhS91q.js";import{D as a,Ft as o,O as s,Ot as c,bt as l,dt as u,i as d,k as f,kt as p,l as m,ot as h}from"./index-pnImGbgQ.js";import{n as g,t as _}from"./DurationHistogram-DlQv4ZCB.js";import{t as v}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as y}from"./ImpactEstimate-Df_laG-n.js";import{t as b}from"./RowPagination-2icPidMP.js";import{r as x}from"./impact-sort-DxaUheWV.js";import{n as S,t as C}from"./finding-anchor-CDbHtqKT.js";import{t as w}from"./usePagedRows-jNUWgVTD.js";import{n as T,t as E}from"./useSortMode-DHlKZeWv.js";import{t as D}from"./StageHeader-CGeWqC-0.js";import{t as O}from"./PlanExplorer-DjGTZifP.js";var k=e(t(),1),A=n();function j({expanded:e,onClick:t,label:n,location:r,controlsId:i}){let a=r?` for ${r}`:``;return(0,A.jsxs)(`button`,{type:`button`,"aria-expanded":e,"aria-controls":i,"aria-label":`${e?`Hide`:`Show`} ${n.toLowerCase()}${a}`,onClick:t,className:`tap-target-comfortable tap-target-comfortable--sm flex w-fit cursor-pointer items-center gap-1 text-xs font-medium text-primary underline underline-offset-2`,children:[n,e?(0,A.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}):(0,A.jsx)(p,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})]})}function M(e){let[t,n]=(0,k.useState)(!1),[r,i]=(0,k.useState)(null),[a,o]=(0,k.useState)(!1),[s,c]=(0,k.useState)(!1),[l,u]=(0,k.useState)(!1);return{expanded:t,data:r,loading:a,error:s,toggle:()=>{let r=!t;n(r),r&&e&&!l&&!a&&(o(!0),e().then(e=>i(e)).catch(()=>c(!0)).finally(()=>{u(!0),o(!1)}))}}}function N({group:e,appModel:t,getTaskData:n,idPrefix:s,findingLabel:c}){let{exportMode:l,getTaskData:d}=g(n),{expanded:p,data:m,error:h,toggle:v}=M(d?()=>d(e.stageId):void 0),b=S(e.findings),x=t.stages.get(e.stageId),w=o()===`advanced`&&i(e.stageId,t),T=`${s}-stage-${e.stageId}-detail`;return(0,A.jsxs)(`div`,{ref:b.ref,tabIndex:b.tabIndex,"data-flashed":b.dataFlashed,className:`space-y-2 ${C} transition-colors ${b.flashClassName}`,children:[(0,A.jsx)(D,{stageId:e.stageId,appModel:t}),(0,A.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.findings.map((e,t)=>(0,A.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,A.jsx)(a,{impactBand:e.impactBand}),(0,A.jsx)(`span`,{children:c(e)}),(0,A.jsx)(y,{finding:e}),(0,A.jsx)(f,{children:(0,A.jsx)(r,{confidence:e.confidence,validationRequired:e.validationRequired})})]},t))}),x?.taskDurationP50==null?null:(0,A.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`P50 `,u(x.taskDurationP50),` · P95 `,u(x.taskDurationP95),` · Max`,` `,u(x.taskDurationMax)]}),e.slowHost?(0,A.jsxs)(`p`,{className:`flex items-start gap-2 text-xs`,children:[(0,A.jsx)(a,{impactBand:e.slowHost.impactBand,className:`mt-1`}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`strong`,{children:`Slow host:`}),` `,e.slowHost.host,` (`,e.slowHost.value,`× median,`,` `,Math.round((e.slowHost.hostTaskShare??0)*100),`% of tasks)`]})]}):null,e.straggler?(0,A.jsxs)(`p`,{className:`flex items-start gap-2 text-xs`,children:[(0,A.jsx)(a,{impactBand:e.straggler.impactBand,className:`mt-1`}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`strong`,{children:`Stragglers:`}),` `,(e.straggler.speculativeTasks??0)>0?`${e.straggler.speculativeTasks} speculative task${e.straggler.speculativeTasks===1?``:`s`}`:`${e.straggler.value}% of tasks > 4× P50`]})]}):null,(0,A.jsx)(j,{expanded:p,onClick:v,label:`Task detail`,location:`Stage ${e.stageId}`,controlsId:T}),p?(0,A.jsxs)(`div`,{id:T,className:`space-y-3 pt-1`,children:[m?(0,A.jsx)(_,{metrics:m.metrics,fieldNames:m.fieldNames,markers:{p50:x?.taskDurationP50,p95:x?.taskDurationP95}}):l?(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Task data isn’t included in exported reports.`}):h?(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Task data unavailable for this stage.`}):(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading task data…`}),w?(0,A.jsx)(O,{stageId:e.stageId,appModel:t}):null]}):null]})}var P=(0,k.memo)(function({appModel:e,catalog:t,getTaskData:n,defaultCollapsed:r=!0,type:i,title:a,idPrefix:o,findingLabel:c}){let[u,f]=(0,k.useState)(0),{sortMode:p,setSortMode:g,orderBy:_}=E(),[y,S]=(0,k.useState)(!r),{relevant:C,stageGroups:D,orderedGroups:O}=(0,k.useMemo)(()=>{let e=t.filter(e=>e.type===i),n=new Map;for(let t of e)t.stageId!=null&&(n.has(t.stageId)||n.set(t.stageId,[]),n.get(t.stageId).push(t));let r=[...n.entries()].map(([e,n])=>({stageId:e,findings:n,impactBand:l(n)??`info`,slowHost:t.find(t=>t.type===`slowHost`&&t.stageId===e),straggler:t.find(t=>t.type===`straggler`&&t.stageId===e)})).sort((e,t)=>h[e.impactBand]-h[t.impactBand]||e.stageId-t.stageId);return{relevant:e,stageGroups:r,orderedGroups:_(r,e=>e.findings,e=>e.stageId)}},[t,p,i]),j=m(),M=j?O.findIndex(e=>e.findings.some(e=>e===j.finding)):null,{totalPages:P,effectivePage:F,visible:I}=w(O,u,f,M);if(C.length===0)return null;let L=l(C);return(0,A.jsxs)(d,{title:a,impactBand:L,badges:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(s,{type:i,impactBand:L??`info`}),x(C,D.length,y)?(0,A.jsx)(T,{mode:p,onChange:g}):null]}),open:y,onOpenChange:S,summary:(0,A.jsx)(v,{value:`${D.length} stage${D.length===1?``:`s`}`,context:`${C.length} finding${C.length===1?``:`s`} flagged`}),children:[(0,A.jsx)(`div`,{className:`space-y-3`,children:I.map(t=>(0,A.jsx)(N,{group:t,appModel:e,getTaskData:n,idPrefix:o,findingLabel:c},t.stageId))}),(0,A.jsx)(b,{page:F,totalPages:P,onPrev:()=>f(e=>e-1),onNext:()=>f(e=>e+1)})]})});export{P as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{t}from"./StagePill-
|
|
1
|
+
import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{t}from"./StagePill-BwwKLcFl.js";var n=e();function r({stageId:e,appModel:r}){let i=r.stages.get(e);return(0,n.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,n.jsx)(t,{stageId:e}),(0,n.jsx)(`span`,{className:`text-sm font-medium`,children:i?.name??`Stage ${e}`})]})}export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{Lt as r,n as i}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{Lt as r,n as i}from"./index-pnImGbgQ.js";var a=e(t(),1),o=n(),s=`inline-flex h-7 shrink-0 cursor-pointer items-center gap-1 rounded-full border border-border bg-background px-2.5 text-xs font-medium whitespace-nowrap outline-none transition-colors hover:bg-muted focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`;function c({stageId:e,className:t}){let{openStage:n}=i();return(0,o.jsxs)(`button`,{type:`button`,className:r(s,t),title:`Open details for Stage ${e}`,"aria-label":`Open details for Stage ${e}`,onClick:()=>n(e),children:[`S`,(0,o.jsx)(`b`,{children:e})]})}var l=30;function u(e,{limit:t=6,chunk:n=l,dataset:r=e}={}){let[i,o]=(0,a.useState)({dataset:r,revealed:0}),s=!Object.is(i.dataset,r);s&&o({dataset:r,revealed:0});let c=t+(s?0:i.revealed);return{visible:e.slice(0,c),remaining:Math.max(0,e.length-c),revealMore:()=>o(e=>({dataset:r,revealed:(Object.is(e.dataset,r)?e.revealed:0)+n})),revealThrough:e=>o(n=>{let i=Object.is(n.dataset,r)?n.revealed:0,a=Math.max(i,e-t+1);return a>i?{dataset:r,revealed:a}:n})}}function d({pills:e,visibleLimit:t=6,pillOverrideClassName:n}){let i=new Set,a=e.filter(e=>!i.has(e.id)&&(i.add(e.id),!0)),{visible:l,remaining:d,revealMore:f}=u(a,{limit:t,dataset:JSON.stringify(a.map(({id:e})=>e))}),p=a.slice(l.length);return(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[l.map(e=>(0,o.jsx)(c,{stageId:e.id,className:n},e.id)),d>0&&(0,o.jsxs)(`button`,{type:`button`,className:r(s,`bg-muted`,n),title:`Also flagged: Stage ${p.map(e=>e.id).join(`, Stage `)}`,"aria-label":`Show ${d} more stage${d===1?``:`s`}`,onClick:f,children:[`+`,d]})]})}export{d as n,c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{t as r}from"./StageFindingGroup-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{t as r}from"./StageFindingGroup-R4OW-g4U.js";var i=e(t(),1),a=n(),o={lowParallelism:`Low parallelism`,dataExplosion:`Data explosion`,taskStageSkew:`Task/stage skew`};function s(e){let t=typeof e.rule==`string`?e.rule:void 0;return`${(t&&o[t])??e.metric??`stage shape`}: ${e.value}`}var c=(0,i.memo)(function(e){return(0,a.jsx)(r,{...e,type:`stageShape`,title:`Stage Shape`,idPrefix:`stage-shape`,findingLabel:s})});export{c as StageShape};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,i as a,l as o,ot as s}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,i as a,l as o,ot as s}from"./index-pnImGbgQ.js";import{t as c}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as l}from"./ImpactEstimate-Df_laG-n.js";import{t as u}from"./RowPagination-2icPidMP.js";import{r as d}from"./impact-sort-DxaUheWV.js";import{n as f}from"./finding-anchor-CDbHtqKT.js";import{t as p}from"./usePagedRows-jNUWgVTD.js";import{n as m,t as h}from"./useSortMode-DHlKZeWv.js";import{t as g}from"./StageHeader-CGeWqC-0.js";var _=e(t(),1),v=n();function y(e){return`${e.value}m stage duration`}function b({finding:e,appModel:t}){let n=f([e]);return(0,v.jsxs)(`li`,{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-1 text-sm transition-colors ${n.flashClassName}`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(r,{impactBand:e.impactBand}),e.stageId==null?null:(0,v.jsx)(g,{stageId:e.stageId,appModel:t}),(0,v.jsx)(`strong`,{children:y(e)})]}),(0,v.jsx)(l,{finding:e}),(0,v.jsx)(`p`,{className:`text-muted-foreground pt-1`,children:e.recommendation})]})}var x=(0,_.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let{sortMode:r,setSortMode:l,orderBy:f}=h(),[g,x]=(0,_.useState)(!n),[S,C]=(0,_.useState)(0),w=t.filter(e=>e.type===`stageSlowness`).slice().sort((e,t)=>s[e.impactBand]-s[t.impactBand]),T=f(w,e=>[e],e=>e.stageId??null),E=o(),D=E?T.findIndex(e=>e===E.finding):null,{totalPages:O,effectivePage:k,visible:A}=p(T,S,C,D);return w.length===0?null:(0,v.jsxs)(a,{title:`Slow Stage`,impactBand:w[0].impactBand,badges:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(i,{type:`stageSlowness`,impactBand:w[0].impactBand}),d(w,w.length,g)?(0,v.jsx)(m,{mode:r,onChange:l}):null]}),open:g,onOpenChange:x,summary:(0,v.jsx)(c,{value:y(w[0]),context:`${w.length} issue${w.length===1?``:`s`} flagged`}),children:[(0,v.jsx)(`ul`,{className:`space-y-2`,children:A.map(t=>(0,v.jsx)(b,{finding:t,appModel:e},t.id))}),(0,v.jsx)(u,{page:k,totalPages:O,onPrev:()=>C(e=>e-1),onNext:()=>C(e=>e+1)})]})});export{x as StageSlowness};
|