{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "spark-job-stage-visualizer",
  "title": "Spark Job Stage Visualizer",
  "type": "registry:page",
  "files": [
    {
      "path": "packages/registry-react/blocks/spark-job-stage-visualizer/SparkJobStageVisualizer.tsx",
      "content": "'use client'\n\nimport * as React from 'react'\nimport { Check, CheckCircle2, Clock, Copy, Download, Flame, Server, ShieldAlert, X } from 'lucide-react'\nimport { cn } from '@/lib/utils'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'\nimport { SparkJobKpis } from './SparkJobKpis'\nimport { SparkStageDagTab } from './SparkStageDagTab'\nimport { SparkStageSkewTab } from './SparkStageSkewTab'\nimport { SparkExecutorsAqe } from './SparkExecutorsAqe'\nimport type {\n  AqeRule,\n  ExecutorStatus,\n  SparkExecutor,\n  SparkStage,\n  StageStatus,\n  TaskBreakdownMetrics,\n  TaskQuantiles,\n} from './spark-stage-types'\nimport { defaultStages } from './spark-stage-data'\n\nexport type { AqeRule, ExecutorStatus, SparkExecutor, SparkStage, StageStatus, TaskBreakdownMetrics, TaskQuantiles }\n\nexport interface SparkJobStageVisualizerProps {\n  initialStageId?: number\n  stages?: SparkStage[]\n  className?: string\n}\n\nexport function SparkJobStageVisualizer({\n  initialStageId = 2,\n  stages = defaultStages,\n  className,\n}: SparkJobStageVisualizerProps) {\n  const [selectedStageId, setSelectedStageId] = React.useState<number>(initialStageId)\n  const [activeTab, setActiveTab] = React.useState<string>('dag')\n  const [copiedAppId, setCopiedAppId] = React.useState<boolean>(false)\n  const [showKillConfirm, setShowKillConfirm] = React.useState<boolean>(false)\n  const [downloadStarted, setDownloadStarted] = React.useState<boolean>(false)\n\n  const selectedStage = React.useMemo(() => {\n    return stages.find((s) => s.id === selectedStageId) ?? stages[2] ?? stages[0]\n  }, [stages, selectedStageId])\n\n  const copyAppId = React.useCallback(() => {\n    navigator.clipboard?.writeText('app-20260821-142850-0042')\n    setCopiedAppId(true)\n    setTimeout(() => {\n      setCopiedAppId(false)\n    }, 2000)\n  }, [])\n\n  const triggerDownload = React.useCallback(() => {\n    setDownloadStarted(true)\n    setTimeout(() => {\n      setDownloadStarted(false)\n    }, 2500)\n  }, [])\n\n  return (\n    <div className={cn('text-foreground w-full space-y-6 font-sans antialiased', className)}>\n      {/* Header Section */}\n      <div className=\"border-border bg-card rounded-xl border p-5 shadow-xs transition-colors\">\n        <div className=\"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between\">\n          {/* Title & Identifiers */}\n          <div className=\"space-y-1.5\">\n            <div className=\"flex flex-wrap items-center gap-2.5\">\n              <div className=\"flex size-9 items-center justify-center rounded-lg bg-orange-500/10 text-orange-600 dark:text-orange-400\">\n                <Flame className=\"size-5\" />\n              </div>\n              <div>\n                <div className=\"flex flex-wrap items-center gap-2\">\n                  <h1 className=\"text-base font-semibold tracking-tight sm:text-lg\">AggregatedCustomerLTVJob</h1>\n                  <Badge wrap variant=\"outline\" className=\"text-muted-foreground font-mono text-xs\">\n                    app-20260821-142850-0042\n                  </Badge>\n                  <Button\n                    variant=\"ghost\"\n                    size=\"xs\"\n                    className=\"text-muted-foreground hover:text-foreground h-6 px-1.5 text-xs\"\n                    aria-label=\"Copy Spark Application ID\"\n                    onClick={copyAppId}\n                  >\n                    {copiedAppId ? <Check className=\"text-success size-3\" /> : <Copy className=\"size-3\" />}\n                    <span className=\"sr-only\">Copy Application ID</span>\n                  </Button>\n                </div>\n                <p className=\"text-muted-foreground text-xs\">\n                  Apache Spark 3.5.1 · Adaptive Query Execution (AQE) Enabled\n                </p>\n              </div>\n            </div>\n\n            {/* Metadata Tags */}\n            <div className=\"text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-1 pt-1 text-xs\">\n              <div className=\"flex items-center gap-1.5\">\n                <span className=\"bg-success size-2 rounded-full\" />\n                <span className=\"text-foreground font-medium\">Job Succeeded</span>\n                <span>·</span>\n                <span className=\"font-mono tabular-nums\">03m:42s</span>\n              </div>\n              <div className=\"flex items-center gap-1\">\n                <Server className=\"size-3.5\" />\n                <span>\n                  Cluster: <strong className=\"text-foreground font-medium\">c5d.4xlarge (4 nodes · 112 vCPUs)</strong>\n                </span>\n              </div>\n              <div className=\"flex items-center gap-1\">\n                <Clock className=\"size-3.5\" />\n                <span>\n                  Started: <strong className=\"text-foreground font-medium\">14:28:50 UTC</strong>\n                </span>\n              </div>\n            </div>\n          </div>\n\n          {/* Action Buttons */}\n          <div className=\"flex flex-wrap items-center gap-2\">\n            <Button\n              aria-label=\"Download attachment\"\n              variant=\"outline\"\n              size=\"sm\"\n              className=\"h-8 gap-1.5 text-xs\"\n              disabled={downloadStarted}\n              onClick={triggerDownload}\n            >\n              {downloadStarted ? <CheckCircle2 className=\"text-success size-3.5\" /> : <Download className=\"size-3.5\" />}\n              <span>{downloadStarted ? 'Log Exported' : 'Download EventLog'}</span>\n            </Button>\n\n            <Button\n              variant=\"ghost\"\n              size=\"sm\"\n              className=\"text-destructive hover:bg-destructive/10 hover:text-destructive h-8 gap-1.5 text-xs\"\n              onClick={() => setShowKillConfirm(!showKillConfirm)}\n            >\n              <X className=\"size-3.5\" />\n              <span>Kill Application</span>\n            </Button>\n          </div>\n        </div>\n\n        {/* Kill Confirmation Alert (Collapsible) */}\n        {showKillConfirm && (\n          <div className=\"border-destructive/30 bg-destructive/5 text-destructive mt-4 flex items-center justify-between rounded-lg border p-3 text-xs\">\n            <div className=\"flex flex-wrap items-center gap-2\">\n              <ShieldAlert className=\"size-4 shrink-0\" />\n              <span>\n                This application is in finished state (SUCCEEDED). Terminating an inactive application will release log\n                retention locks.\n              </span>\n            </div>\n            <div className=\"flex flex-wrap items-center gap-2\">\n              <Button size=\"xs\" variant=\"destructive\" onClick={() => setShowKillConfirm(false)}>\n                Confirm Release\n              </Button>\n              <Button size=\"xs\" variant=\"ghost\" onClick={() => setShowKillConfirm(false)}>\n                Cancel\n              </Button>\n            </div>\n          </div>\n        )}\n      </div>\n\n      {/* 4 Spark Job Execution KPI Cards */}\n      <SparkJobKpis />\n\n      {/* Main Content Tabs */}\n      <Tabs value={activeTab} onValueChange={setActiveTab} className=\"space-y-4\">\n        <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n          <TabsList className=\"grid w-full grid-cols-2 sm:w-auto sm:grid-cols-4\">\n            <TabsTrigger value=\"dag\" className=\"text-xs\">\n              Stages DAG Flow\n            </TabsTrigger>\n            <TabsTrigger value=\"skew\" className=\"text-xs\">\n              Task Skew & Quantiles\n            </TabsTrigger>\n            <TabsTrigger value=\"executors\" className=\"text-xs\">\n              Executors (4)\n            </TabsTrigger>\n            <TabsTrigger value=\"aqe\" className=\"text-xs\">\n              AQE Optimizer\n            </TabsTrigger>\n          </TabsList>\n\n          <div className=\"text-muted-foreground flex flex-wrap items-center gap-2 text-xs\">\n            <span className=\"bg-primary inline-block size-2 rounded-full\" />\n            <span>Active Selection:</span>\n            <span className=\"text-foreground font-medium\">\n              Stage {selectedStage.id} ({selectedStage.name})\n            </span>\n          </div>\n        </div>\n\n        {/* TAB 1: INTERACTIVE SPARK STAGES DAG FLOW */}\n        <SparkStageDagTab\n          selectedStage={selectedStage}\n          selectedStageId={selectedStageId}\n          stages={stages}\n          onSelectStage={setSelectedStageId}\n        />\n\n        {/* TAB 2: TASK SKEW & QUANTILES DISTRIBUTION */}\n        <SparkStageSkewTab\n          selectedStage={selectedStage}\n          stages={stages}\n          selectedStageId={selectedStageId}\n          onSelectStage={setSelectedStageId}\n        />\n\n        {/* TAB 3 & 4: Executors + AQE tabs */}\n        <SparkExecutorsAqe />\n      </Tabs>\n    </div>\n  )\n}\n\nexport default SparkJobStageVisualizer\n",
      "type": "registry:page",
      "target": "~/components/blocks/SparkJobStageVisualizer.tsx"
    },
    {
      "path": "packages/registry-react/blocks/spark-job-stage-visualizer/SparkJobKpis.tsx",
      "content": "import * as React from 'react'\nimport { ArrowRightLeft, CheckCircle2, Cpu, Gauge } from 'lucide-react'\nimport { Badge } from '@/components/ui/badge'\nimport { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'\n\nexport function SparkJobKpis() {\n  return (\n    <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n      {/* KPI 1: Stages */}\n      <Card className=\"border-border shadow-xs\">\n        <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n          <CardTitle className=\"text-muted-foreground text-xs font-medium\"> Total Stages Completed </CardTitle>\n          <div className=\"bg-success/10 text-success flex size-7 items-center justify-center rounded-md\">\n            <CheckCircle2 className=\"size-4\" />\n          </div>\n        </CardHeader>\n        <CardContent className=\"space-y-2\">\n          <div className=\"text-foreground font-mono text-2xl font-bold tracking-tight\">6 / 6</div>\n          <div className=\"flex flex-wrap items-center gap-2\">\n            <Badge wrap variant=\"success\" className=\"text-xs\">\n              {' '}\n              6 / 6 Stages Succeeded{' '}\n            </Badge>\n          </div>\n          <p className=\"text-muted-foreground text-xs\">0 failed · 0 skipped · 4 stages active in DAG</p>\n        </CardContent>\n      </Card>\n\n      {/* KPI 2: Shuffle & Spill */}\n      <Card className=\"border-border shadow-xs\">\n        <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n          <CardTitle className=\"text-muted-foreground text-xs font-medium\"> Shuffle Read / Write Volume </CardTitle>\n          <div className=\"bg-info/10 text-info flex size-7 items-center justify-center rounded-md\">\n            <ArrowRightLeft className=\"size-4\" />\n          </div>\n        </CardHeader>\n        <CardContent className=\"space-y-2\">\n          <div className=\"text-foreground font-mono text-2xl font-bold tracking-tight tabular-nums\">42.8 GB</div>\n          <div className=\"text-muted-foreground flex items-center gap-1.5 text-xs\">\n            <span className=\"text-foreground font-medium\">42.8 GB Shuffle Write</span>\n            <span>·</span>\n            <span className=\"text-warning font-mono\">1.48 GB Spill (Memory)</span>\n          </div>\n          <p className=\"text-muted-foreground text-xs\">38.6 GB shuffle read · 0 B disk spill</p>\n        </CardContent>\n      </Card>\n\n      {/* KPI 3: Task Skew Ratio */}\n      <Card className=\"border-border shadow-xs\">\n        <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n          <CardTitle className=\"text-muted-foreground text-xs font-medium\"> Task Skew Max/Median Ratio </CardTitle>\n          <div className=\"bg-success/10 text-success flex size-7 items-center justify-center rounded-md\">\n            <Gauge className=\"size-4\" />\n          </div>\n        </CardHeader>\n        <CardContent className=\"space-y-2\">\n          <div className=\"text-foreground font-mono text-2xl font-bold tracking-tight tabular-nums\">1.18x</div>\n          <div className=\"flex flex-wrap items-center gap-2\">\n            <Badge wrap variant=\"success\" className=\"text-xs\">\n              {' '}\n              1.18x Ratio · Well Balanced{' '}\n            </Badge>\n          </div>\n          <p className=\"text-muted-foreground text-xs\">\n            Max task: <span className=\"text-foreground font-mono font-medium\">4.2s</span> · Median:\n            <span className=\"text-foreground font-mono font-medium\">3.5s</span>\n          </p>\n        </CardContent>\n      </Card>\n\n      {/* KPI 4: JVM GC Overhead */}\n      <Card className=\"border-border shadow-xs\">\n        <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n          <CardTitle className=\"text-muted-foreground text-xs font-medium\"> Executor JVM GC Time </CardTitle>\n          <div className=\"bg-chart-1/10 text-chart-1 flex size-7 items-center justify-center rounded-md\">\n            <Cpu className=\"size-4\" />\n          </div>\n        </CardHeader>\n        <CardContent className=\"space-y-2\">\n          <div className=\"text-foreground font-mono text-2xl font-bold tracking-tight tabular-nums\">2.1%</div>\n          <div className=\"flex flex-wrap items-center gap-2\">\n            <Badge wrap variant=\"success\" className=\"text-xs\">\n              {' '}\n              2.1% of Total CPU Time · Healthy{' '}\n            </Badge>\n          </div>\n          <p className=\"text-muted-foreground text-xs\">18.4s GC time across 880s CPU total</p>\n        </CardContent>\n      </Card>\n    </div>\n  )\n}\n",
      "type": "registry:page",
      "target": "~/components/blocks/SparkJobKpis.tsx"
    },
    {
      "path": "packages/registry-react/blocks/spark-job-stage-visualizer/SparkStageDagTab.tsx",
      "content": "import * as React from 'react'\nimport { ArrowDown, Database, Layers, Workflow } from 'lucide-react'\nimport { cn } from '@/lib/utils'\nimport { Badge } from '@/components/ui/badge'\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'\nimport { TabsContent } from '@/components/ui/tabs'\nimport type { SparkStage } from './spark-stage-types'\n\nexport interface SparkStageDagTabProps {\n  selectedStage: SparkStage\n  selectedStageId: number\n  stages: SparkStage[]\n  onSelectStage: (id: number) => void\n}\n\nexport function SparkStageDagTab({\n  selectedStage,\n  selectedStageId,\n  stages: _stages,\n  onSelectStage,\n}: SparkStageDagTabProps) {\n  return (\n    <TabsContent value=\"dag\" className=\"space-y-6 focus-visible:outline-none\">\n      <Card className=\"border-border shadow-xs\">\n        <CardHeader className=\"border-border/60 border-b pb-4\">\n          <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between\">\n            <div>\n              <CardTitle className=\"text-base font-semibold\"> Distributed Job Execution DAG </CardTitle>\n              <CardDescription className=\"text-xs\">\n                Interactive stage graph showing task parallelization, shuffle boundaries, and operator fusion. Click any\n                stage to inspect.\n              </CardDescription>\n            </div>\n            <div className=\"flex flex-wrap items-center gap-2\">\n              <Badge wrap variant=\"outline\" className=\"font-mono text-xs\">\n                AQE Coalesced: 540 → 200 Partitions\n              </Badge>\n            </div>\n          </div>\n        </CardHeader>\n\n        <CardContent className=\"p-6\">\n          {/* DAG Topology Container */}\n          <div className=\"space-y-8\">\n            {/* Two parallel branches joining together */}\n            <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-2\">\n              {/* Left Branch: Transactions */}\n              <div className=\"border-border/80 bg-muted/20 space-y-4 rounded-xl border p-4\">\n                <div className=\"border-border/60 flex items-center justify-between border-b pb-2\">\n                  <div className=\"flex flex-wrap items-center gap-2\">\n                    <Database className=\"size-4 text-orange-500\" />\n                    <span className=\"text-muted-foreground text-xs font-semibold\">\n                      Branch 1: Customer Transactions Pipeline\n                    </span>\n                  </div>\n                  <Badge wrap variant=\"outline\" className=\"font-mono text-xs\">\n                    14.8M records\n                  </Badge>\n                </div>\n\n                {/* Stage 0 */}\n                <div\n                  tabIndex={0}\n                  role=\"button\"\n                  aria-pressed={selectedStageId === 0}\n                  className={cn(\n                    'group focus-visible:ring-ring relative cursor-pointer rounded-lg border p-4 transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none',\n                    selectedStageId === 0\n                      ? 'border-primary bg-primary/5 ring-primary shadow-xs ring-1'\n                      : 'border-border bg-card hover:border-border/80 hover:bg-muted/40',\n                  )}\n                  onClick={() => onSelectStage(0)}\n                  onKeyDown={(e) => {\n                    if (e.key === 'Enter' || e.key === ' ') {\n                      e.preventDefault()\n                      onSelectStage(0)\n                    }\n                  }}\n                >\n                  <div className=\"flex items-start justify-between gap-3\">\n                    <div className=\"space-y-1\">\n                      <div className=\"flex flex-wrap items-center gap-2\">\n                        <Badge wrap variant=\"secondary\" className=\"font-mono text-xs\">\n                          Stage 0\n                        </Badge>\n                        <span className=\"text-foreground text-sm font-semibold\">FileScan parquet</span>\n                      </div>\n                      <p className=\"text-muted-foreground font-mono text-xs\">540 tasks · 18s · 14.2 GB read</p>\n                    </div>\n                    <Badge wrap variant=\"success\" className=\"text-xs\">\n                      Succeeded\n                    </Badge>\n                  </div>\n                  <div className=\"text-muted-foreground mt-3 flex items-center justify-between text-xs\">\n                    <span>Operator: FileScan parquet</span>\n                    <span className=\"text-foreground font-mono tabular-nums\">14.82M rows</span>\n                  </div>\n                </div>\n\n                {/* Connector Arrow */}\n                <div className=\"text-muted-foreground flex items-center justify-center py-0.5\">\n                  <div className=\"border-border bg-card flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 font-mono text-xs\">\n                    <ArrowDown className=\"text-muted-foreground size-3\" />\n                    <span>14.2 GB in-memory scan</span>\n                  </div>\n                </div>\n\n                {/* Stage 1 */}\n                <div\n                  tabIndex={0}\n                  role=\"button\"\n                  aria-pressed={selectedStageId === 1}\n                  className={cn(\n                    'group focus-visible:ring-ring relative cursor-pointer rounded-lg border p-4 transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none',\n                    selectedStageId === 1\n                      ? 'border-primary bg-primary/5 ring-primary shadow-xs ring-1'\n                      : 'border-border bg-card hover:border-border/80 hover:bg-muted/40',\n                  )}\n                  onClick={() => onSelectStage(1)}\n                  onKeyDown={(e) => {\n                    if (e.key === 'Enter' || e.key === ' ') {\n                      e.preventDefault()\n                      onSelectStage(1)\n                    }\n                  }}\n                >\n                  <div className=\"flex items-start justify-between gap-3\">\n                    <div className=\"space-y-1\">\n                      <div className=\"flex flex-wrap items-center gap-2\">\n                        <Badge wrap variant=\"secondary\" className=\"font-mono text-xs\">\n                          Stage 1\n                        </Badge>\n                        <span className=\"text-foreground text-sm font-semibold\">Exchange hashpartitioning</span>\n                      </div>\n                      <p className=\"text-muted-foreground font-mono text-xs\">200 tasks · 42s · 8.4 GB shuffle write</p>\n                    </div>\n                    <Badge wrap variant=\"success\" className=\"text-xs\">\n                      Succeeded\n                    </Badge>\n                  </div>\n                  <div className=\"text-muted-foreground mt-3 flex items-center justify-between text-xs\">\n                    <span>Key: Murmur3(customer_id)</span>\n                    <span className=\"text-foreground font-mono tabular-nums\">200 partitions</span>\n                  </div>\n                </div>\n\n                {/* Connector Arrow */}\n                <div className=\"text-muted-foreground flex items-center justify-center py-0.5\">\n                  <div className=\"border-border bg-card flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 font-mono text-xs\">\n                    <ArrowDown className=\"text-muted-foreground size-3\" />\n                    <span>8.4 GB shuffle transfer</span>\n                  </div>\n                </div>\n\n                {/* Stage 2 */}\n                <div\n                  tabIndex={0}\n                  role=\"button\"\n                  aria-pressed={selectedStageId === 2}\n                  className={cn(\n                    'group focus-visible:ring-ring relative cursor-pointer rounded-lg border p-4 transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none',\n                    selectedStageId === 2\n                      ? 'border-primary bg-primary/5 ring-primary shadow-xs ring-1'\n                      : 'border-border bg-card hover:border-border/80 hover:bg-muted/40',\n                  )}\n                  onClick={() => onSelectStage(2)}\n                  onKeyDown={(e) => {\n                    if (e.key === 'Enter' || e.key === ' ') {\n                      e.preventDefault()\n                      onSelectStage(2)\n                    }\n                  }}\n                >\n                  <div className=\"flex items-start justify-between gap-3\">\n                    <div className=\"space-y-1\">\n                      <div className=\"flex flex-wrap items-center gap-2\">\n                        <Badge wrap variant=\"secondary\" className=\"font-mono text-xs\">\n                          Stage 2\n                        </Badge>\n                        <span className=\"text-foreground text-sm font-semibold\">HashAggregate & Filter</span>\n                      </div>\n                      <p className=\"text-muted-foreground font-mono text-xs\">200 tasks · 1m 12s · 4.6 GB write</p>\n                    </div>\n                    <Badge wrap variant=\"success\" className=\"text-xs\">\n                      Succeeded\n                    </Badge>\n                  </div>\n                  <div className=\"text-muted-foreground mt-3 flex items-center justify-between text-xs\">\n                    <span>Aggregations: sum(amount), count(1)</span>\n                    <span className=\"text-warning text-warning font-mono tabular-nums\">420 MB spill</span>\n                  </div>\n                </div>\n              </div>\n\n              {/* Right Branch: Customer Dim */}\n              <div className=\"border-border/80 bg-muted/20 space-y-4 rounded-xl border p-4\">\n                <div className=\"border-border/60 flex items-center justify-between border-b pb-2\">\n                  <div className=\"flex flex-wrap items-center gap-2\">\n                    <Layers className=\"text-info size-4\" />\n                    <span className=\"text-muted-foreground text-xs font-semibold\">\n                      Branch 2: Customer Dimension Pipeline\n                    </span>\n                  </div>\n                  <Badge wrap variant=\"outline\" className=\"font-mono text-xs\">\n                    2.4M records\n                  </Badge>\n                </div>\n\n                {/* Stage 4 */}\n                <div\n                  tabIndex={0}\n                  role=\"button\"\n                  aria-pressed={selectedStageId === 4}\n                  className={cn(\n                    'group focus-visible:ring-ring relative cursor-pointer rounded-lg border p-4 transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none',\n                    selectedStageId === 4\n                      ? 'border-primary bg-primary/5 ring-primary shadow-xs ring-1'\n                      : 'border-border bg-card hover:border-border/80 hover:bg-muted/40',\n                  )}\n                  onClick={() => onSelectStage(4)}\n                  onKeyDown={(e) => {\n                    if (e.key === 'Enter' || e.key === ' ') {\n                      e.preventDefault()\n                      onSelectStage(4)\n                    }\n                  }}\n                >\n                  <div className=\"flex items-start justify-between gap-3\">\n                    <div className=\"space-y-1\">\n                      <div className=\"flex flex-wrap items-center gap-2\">\n                        <Badge wrap variant=\"secondary\" className=\"font-mono text-xs\">\n                          Stage 4\n                        </Badge>\n                        <span className=\"text-foreground text-sm font-semibold\">FileScan customer_dim</span>\n                      </div>\n                      <p className=\"text-muted-foreground font-mono text-xs\">120 tasks · 12s · 3.1 GB read</p>\n                    </div>\n                    <Badge wrap variant=\"success\" className=\"text-xs\">\n                      Succeeded\n                    </Badge>\n                  </div>\n                  <div className=\"text-muted-foreground mt-3 flex items-center justify-between text-xs\">\n                    <span>Operator: FileScan parquet</span>\n                    <span className=\"text-foreground font-mono tabular-nums\">2.40M rows</span>\n                  </div>\n                </div>\n\n                {/* Connector Arrow */}\n                <div className=\"text-muted-foreground flex items-center justify-center py-0.5\">\n                  <div className=\"border-border bg-card flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 font-mono text-xs\">\n                    <ArrowDown className=\"text-muted-foreground size-3\" />\n                    <span>3.1 GB dimension scan</span>\n                  </div>\n                </div>\n\n                {/* Stage 5 */}\n                <div\n                  tabIndex={0}\n                  role=\"button\"\n                  aria-pressed={selectedStageId === 5}\n                  className={cn(\n                    'group focus-visible:ring-ring relative cursor-pointer rounded-lg border p-4 transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none',\n                    selectedStageId === 5\n                      ? 'border-primary bg-primary/5 ring-primary shadow-xs ring-1'\n                      : 'border-border bg-card hover:border-border/80 hover:bg-muted/40',\n                  )}\n                  onClick={() => onSelectStage(5)}\n                  onKeyDown={(e) => {\n                    if (e.key === 'Enter' || e.key === ' ') {\n                      e.preventDefault()\n                      onSelectStage(5)\n                    }\n                  }}\n                >\n                  <div className=\"flex items-start justify-between gap-3\">\n                    <div className=\"space-y-1\">\n                      <div className=\"flex flex-wrap items-center gap-2\">\n                        <Badge wrap variant=\"secondary\" className=\"font-mono text-xs\">\n                          Stage 5\n                        </Badge>\n                        <span className=\"text-foreground text-sm font-semibold\">Exchange customer_dim</span>\n                      </div>\n                      <p className=\"text-muted-foreground font-mono text-xs\">120 tasks · 16s · 3.1 GB shuffle write</p>\n                    </div>\n                    <Badge wrap variant=\"success\" className=\"text-xs\">\n                      Succeeded\n                    </Badge>\n                  </div>\n                  <div className=\"text-muted-foreground mt-3 flex items-center justify-between text-xs\">\n                    <span>Key: Murmur3(customer_id)</span>\n                    <span className=\"text-foreground font-mono tabular-nums\">200 partitions</span>\n                  </div>\n                </div>\n\n                {/* Branch alignment spacer */}\n                <div className=\"text-muted-foreground hidden items-center justify-center py-5 lg:flex\">\n                  <div className=\"text-muted-foreground flex items-center gap-1 text-xs\">\n                    <Workflow className=\"size-3.5\" />\n                    <span>Ready for hash join</span>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n            {/* Convergence Flow Indicator */}\n            <div className=\"flex flex-col items-center justify-center gap-2\">\n              <div className=\"border-border bg-muted/60 text-muted-foreground flex flex-wrap items-center gap-2 rounded-full border px-3 py-1 font-mono text-xs\">\n                <Workflow className=\"text-primary size-3.5\" />\n                <span>Shuffle Partition Alignment (200 Partitions × 2 Inputs)</span>\n              </div>\n              <ArrowDown className=\"text-muted-foreground size-4\" />\n            </div>\n\n            {/* Joined Final Stage: Stage 3 */}\n            <div\n              tabIndex={0}\n              role=\"button\"\n              aria-pressed={selectedStageId === 3}\n              className={cn(\n                'group focus-visible:ring-ring relative cursor-pointer rounded-xl border p-5 transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none',\n                selectedStageId === 3\n                  ? 'border-primary bg-primary/5 ring-primary shadow-sm ring-1'\n                  : 'border-border bg-card hover:border-border/80 hover:bg-muted/40',\n              )}\n              onClick={() => onSelectStage(3)}\n              onKeyDown={(e) => {\n                if (e.key === 'Enter' || e.key === ' ') {\n                  e.preventDefault()\n                  onSelectStage(3)\n                }\n              }}\n            >\n              <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n                <div className=\"space-y-1\">\n                  <div className=\"flex flex-wrap items-center gap-2\">\n                    <Badge wrap variant=\"default\" className=\"font-mono text-xs\">\n                      Stage 3\n                    </Badge>\n                    <h3 className=\"text-foreground text-base font-semibold\">SortMergeJoin (Final Reduction)</h3>\n                    <Badge wrap variant=\"outline\" className=\"font-mono text-xs\">\n                      Terminal Stage\n                    </Badge>\n                  </div>\n                  <p className=\"text-muted-foreground font-mono text-xs\">\n                    200 tasks · 1m 20s · Joined 14.8M keys · 1.24M output rows\n                  </p>\n                </div>\n                <div className=\"flex items-center gap-3\">\n                  <div className=\"text-right text-xs\">\n                    <div className=\"text-foreground font-mono font-medium\">29.8 GB Output</div>\n                    <div className=\"text-warning font-mono\">1.06 GB Mem Spill</div>\n                  </div>\n                  <Badge wrap variant=\"success\" className=\"text-xs\">\n                    Succeeded\n                  </Badge>\n                </div>\n              </div>\n\n              <div className=\"border-border/60 mt-4 grid grid-cols-2 gap-2 border-t pt-3 text-xs sm:grid-cols-4\">\n                <div>\n                  <span className=\"text-muted-foreground\">Join Type:</span>\n                  <p className=\"text-foreground font-mono font-medium\">Inner SortMergeJoin</p>\n                </div>\n                <div>\n                  <span className=\"text-muted-foreground\">Join Key:</span>\n                  <p className=\"text-foreground font-mono font-medium\">customer_id#42 = customer_id#98</p>\n                </div>\n                <div>\n                  <span className=\"text-muted-foreground\">Tasks:</span>\n                  <p className=\"text-foreground font-mono font-medium\">200 / 200 (100%)</p>\n                </div>\n                <div>\n                  <span className=\"text-muted-foreground\">Skew Max/Median:</span>\n                  <p className=\"text-success font-mono font-medium\">1.21x (Balanced)</p>\n                </div>\n              </div>\n            </div>\n          </div>\n        </CardContent>\n      </Card>\n\n      {/* Selected Stage Deep Inspector */}\n      <Card className=\"border-border shadow-xs\">\n        <CardHeader className=\"border-border/60 border-b pb-3\">\n          <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between\">\n            <div className=\"flex flex-wrap items-center gap-2\">\n              <Badge wrap variant=\"secondary\" className=\"font-mono text-xs\">\n                Selected Stage {selectedStage.id}\n              </Badge>\n              <CardTitle className=\"text-sm font-semibold\">{selectedStage.name} Details</CardTitle>\n            </div>\n            <div className=\"flex flex-wrap items-center gap-2\">\n              <span className=\"text-muted-foreground text-xs\">Duration:</span>\n              <Badge wrap variant=\"outline\" className=\"font-mono text-xs\">\n                {selectedStage.duration}\n              </Badge>\n              <Badge wrap variant=\"success\" className=\"text-xs\">\n                Completed\n              </Badge>\n            </div>\n          </div>\n        </CardHeader>\n\n        <CardContent className=\"space-y-4 p-5\">\n          {/* Call Site Code Box */}\n          <div className=\"space-y-1.5\">\n            <span className=\"text-muted-foreground text-xs font-medium\">Catalyst Operator Expression</span>\n            <div className=\"border-border bg-muted/40 text-foreground rounded-md border p-3 font-mono text-xs\">\n              <code>{selectedStage.operator}</code>\n            </div>\n          </div>\n\n          {/* Stage Metrics Grid */}\n          <div className=\"grid grid-cols-2 gap-3 text-xs sm:grid-cols-4 lg:grid-cols-6\">\n            <div className=\"border-border/80 bg-card rounded-lg border p-3\">\n              <span className=\"text-muted-foreground\">Tasks</span>\n              <p className=\"text-foreground mt-1 font-mono text-sm font-semibold\">\n                {selectedStage.tasksSucceeded} / {selectedStage.tasksTotal}\n              </p>\n            </div>\n            <div className=\"border-border/80 bg-card rounded-lg border p-3\">\n              <span className=\"text-muted-foreground\">Input Data</span>\n              <p className=\"text-foreground mt-1 font-mono text-sm font-semibold\">{selectedStage.inputBytes}</p>\n            </div>\n            <div className=\"border-border/80 bg-card rounded-lg border p-3\">\n              <span className=\"text-muted-foreground\">Shuffle Read</span>\n              <p className=\"text-foreground mt-1 font-mono text-sm font-semibold\">{selectedStage.shuffleReadBytes}</p>\n            </div>\n            <div className=\"border-border/80 bg-card rounded-lg border p-3\">\n              <span className=\"text-muted-foreground\">Shuffle Write</span>\n              <p className=\"text-foreground mt-1 font-mono text-sm font-semibold\">{selectedStage.shuffleWriteBytes}</p>\n            </div>\n            <div className=\"border-border/80 bg-card rounded-lg border p-3\">\n              <span className=\"text-muted-foreground\">Spill (Memory)</span>\n              <p className=\"text-warning mt-1 font-mono text-sm font-semibold\">{selectedStage.spillMemory}</p>\n            </div>\n            <div className=\"border-border/80 bg-card rounded-lg border p-3\">\n              <span className=\"text-muted-foreground\">Task Skew Ratio</span>\n              <p className=\"text-success mt-1 font-mono text-sm font-semibold\">{selectedStage.skewRatio}x</p>\n            </div>\n          </div>\n\n          <p className=\"text-muted-foreground text-xs leading-relaxed\">{selectedStage.details}</p>\n        </CardContent>\n      </Card>\n    </TabsContent>\n  )\n}\n",
      "type": "registry:page",
      "target": "~/components/blocks/SparkStageDagTab.tsx"
    },
    {
      "path": "packages/registry-react/blocks/spark-job-stage-visualizer/SparkStageSkewTab.tsx",
      "content": "import * as React from 'react'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'\nimport { TabsContent } from '@/components/ui/tabs'\nimport type { SparkStage } from './spark-stage-types'\nimport { getQuantilePosition } from './spark-stage-data'\n\nexport interface SparkStageSkewTabProps {\n  selectedStage: SparkStage\n  stages: SparkStage[]\n  selectedStageId: number\n  onSelectStage: (id: number) => void\n}\n\nexport function SparkStageSkewTab({ selectedStage, stages, selectedStageId, onSelectStage }: SparkStageSkewTabProps) {\n  return (\n    <TabsContent value=\"skew\" className=\"space-y-6 focus-visible:outline-none\">\n      <Card className=\"border-border shadow-xs\">\n        <CardHeader className=\"border-border/60 border-b pb-4\">\n          <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n            <div>\n              <CardTitle className=\"text-base font-semibold\"> Stage Task Duration Skew & Quantiles </CardTitle>\n              <CardDescription className=\"text-xs\">\n                Distribution of task execution time across executor cores for the selected stage.\n              </CardDescription>\n            </div>\n\n            {/* Quick Stage Selector Buttons */}\n            <div className=\"flex flex-wrap items-center gap-1.5\">\n              {stages.map((s) => (\n                <Button\n                  key={s.id}\n                  size=\"xs\"\n                  variant={selectedStageId === s.id ? 'default' : 'outline'}\n                  className=\"font-mono text-xs\"\n                  onClick={() => onSelectStage(s.id)}\n                >\n                  Stage {s.id}\n                </Button>\n              ))}\n            </div>\n          </div>\n        </CardHeader>\n\n        <CardContent className=\"space-y-6 p-6\">\n          {/* Stage Title & Skew Ratio Banner */}\n          <div className=\"border-border bg-muted/20 flex flex-col gap-3 rounded-lg border p-4 sm:flex-row sm:items-center sm:justify-between\">\n            <div className=\"space-y-0.5\">\n              <div className=\"flex flex-wrap items-center gap-2\">\n                <span className=\"text-foreground text-sm font-semibold\">\n                  Stage {selectedStage.id}: {selectedStage.name}\n                </span>\n                <Badge wrap variant=\"outline\" className=\"font-mono text-xs\">\n                  {selectedStage.tasksTotal} Tasks\n                </Badge>\n              </div>\n              <p className=\"text-muted-foreground text-xs\">\n                Duration: <span className=\"text-foreground font-mono font-medium\">{selectedStage.duration}</span> · Peak\n                task memory: <span className=\"text-foreground font-mono\">{selectedStage.taskBreakdown.peakMemory}</span>\n              </p>\n            </div>\n\n            <div className=\"flex items-center gap-3\">\n              <div className=\"text-right\">\n                <span className=\"text-muted-foreground text-xs\">Max / Median Skew:</span>\n                <div className=\"text-success font-mono text-base font-bold\">{selectedStage.skewRatio}x</div>\n              </div>\n              <Badge wrap variant=\"success\" className=\"text-xs\">\n                {' '}\n                Well Balanced (&lt; 1.5x){' '}\n              </Badge>\n            </div>\n          </div>\n\n          {/* Quantiles Metric Row (Min, P25, Median, P75, P95, Max) */}\n          <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-6\">\n            <div className=\"border-border bg-card rounded-lg border p-3 text-center\">\n              <span className=\"text-muted-foreground text-xs font-medium\">Min (0%)</span>\n              <p className=\"text-foreground mt-1 font-mono text-lg font-bold tabular-nums\">\n                {selectedStage.quantiles.min}s\n              </p>\n              <span className=\"text-muted-foreground text-xs\">Fastest task</span>\n            </div>\n\n            <div className=\"border-border bg-card rounded-lg border p-3 text-center\">\n              <span className=\"text-muted-foreground text-xs font-medium\">25th Percentile</span>\n              <p className=\"text-foreground mt-1 font-mono text-lg font-bold tabular-nums\">\n                {selectedStage.quantiles.p25}s\n              </p>\n              <span className=\"text-muted-foreground text-xs\">Q1 boundary</span>\n            </div>\n\n            <div className=\"border-primary/40 bg-primary/5 ring-primary/20 rounded-lg border p-3 text-center ring-1\">\n              <span className=\"text-primary text-xs font-medium\">Median (P50)</span>\n              <p className=\"text-primary mt-1 font-mono text-lg font-bold tabular-nums\">\n                {selectedStage.quantiles.median}s\n              </p>\n              <span className=\"text-muted-foreground text-xs\">Midpoint baseline</span>\n            </div>\n\n            <div className=\"border-border bg-card rounded-lg border p-3 text-center\">\n              <span className=\"text-muted-foreground text-xs font-medium\">75th Percentile</span>\n              <p className=\"text-foreground mt-1 font-mono text-lg font-bold tabular-nums\">\n                {selectedStage.quantiles.p75}s\n              </p>\n              <span className=\"text-muted-foreground text-xs\">Q3 boundary</span>\n            </div>\n\n            <div className=\"border-border bg-card rounded-lg border p-3 text-center\">\n              <span className=\"text-muted-foreground text-xs font-medium\">95th Percentile</span>\n              <p className=\"text-foreground mt-1 font-mono text-lg font-bold tabular-nums\">\n                {selectedStage.quantiles.p95}s\n              </p>\n              <span className=\"text-muted-foreground text-xs\">Tail latency</span>\n            </div>\n\n            <div className=\"border-border bg-card rounded-lg border p-3 text-center\">\n              <span className=\"text-muted-foreground text-xs font-medium\">Max (100%)</span>\n              <p className=\"text-foreground mt-1 font-mono text-lg font-bold tabular-nums\">\n                {selectedStage.quantiles.max}s\n              </p>\n              <span className=\"text-muted-foreground text-xs\">Straggler peak</span>\n            </div>\n          </div>\n\n          {/* Visual Distribution Bar */}\n          <div className=\"border-border bg-muted/10 space-y-3 rounded-lg border p-5\">\n            <div className=\"text-muted-foreground flex items-center justify-between text-xs\">\n              <span className=\"text-foreground font-medium\">Task Duration Quantiles Scale (0.0s – 5.0s)</span>\n              <span className=\"font-mono\">\n                IQR: {(selectedStage.quantiles.p75 - selectedStage.quantiles.p25).toFixed(1)}s\n              </span>\n            </div>\n\n            {/* Custom Box & Whisker Horizontal Bar */}\n            <div className=\"relative pt-6 pb-2\">\n              {/* Background track */}\n              <div className=\"bg-muted relative h-4 w-full overflow-hidden rounded-full\">\n                {/* Min to Max Range Bar */}\n                <div\n                  className=\"bg-primary/20 absolute top-0 bottom-0 rounded-full\"\n                  style={{\n                    left: `${getQuantilePosition(selectedStage.quantiles.min)}%`,\n                    width: `${getQuantilePosition(selectedStage.quantiles.max) - getQuantilePosition(selectedStage.quantiles.min)}%`,\n                  }}\n                />\n                {/* P25 to P75 Interquartile Core */}\n                <div\n                  className=\"bg-primary/70 absolute top-0 bottom-0\"\n                  style={{\n                    left: `${getQuantilePosition(selectedStage.quantiles.p25)}%`,\n                    width: `${getQuantilePosition(selectedStage.quantiles.p75) - getQuantilePosition(selectedStage.quantiles.p25)}%`,\n                  }}\n                />\n                {/* Median Marker */}\n                <div\n                  className=\"absolute top-0 bottom-0 z-10 w-1 bg-white dark:bg-black\"\n                  style={{\n                    left: `${getQuantilePosition(selectedStage.quantiles.median)}%`,\n                  }}\n                />\n              </div>\n\n              {/* Markers with Pin Labels */}\n              <div\n                className=\"text-muted-foreground absolute top-0 -translate-x-1/2 font-mono text-xs\"\n                style={{ left: `${getQuantilePosition(selectedStage.quantiles.min)}%` }}\n              >\n                Min {selectedStage.quantiles.min}s\n              </div>\n              <div\n                className=\"text-primary absolute top-0 -translate-x-1/2 font-mono text-xs font-semibold\"\n                style={{ left: `${getQuantilePosition(selectedStage.quantiles.median)}%` }}\n              >\n                Med {selectedStage.quantiles.median}s\n              </div>\n              <div\n                className=\"text-muted-foreground absolute top-0 -translate-x-1/2 font-mono text-xs\"\n                style={{ left: `${getQuantilePosition(selectedStage.quantiles.max)}%` }}\n              >\n                Max {selectedStage.quantiles.max}s\n              </div>\n            </div>\n\n            <div className=\"border-border/60 text-muted-foreground flex flex-wrap items-center justify-between gap-2 border-t pt-3 text-xs\">\n              <div className=\"flex items-center gap-4\">\n                <div className=\"flex items-center gap-1.5\">\n                  <span className=\"bg-primary/20 size-2.5 rounded\" />\n                  <span>Full Range (Min - Max)</span>\n                </div>\n                <div className=\"flex items-center gap-1.5\">\n                  <span className=\"bg-primary/70 size-2.5 rounded\" />\n                  <span>IQR Core (P25 - P75)</span>\n                </div>\n                <div className=\"flex items-center gap-1.5\">\n                  <span className=\"bg-foreground h-2.5 w-0.5\" />\n                  <span>Median Point</span>\n                </div>\n              </div>\n              <span>\n                Skew status: <strong className=\"text-success font-medium\">Optimal Partitioning</strong>\n              </span>\n            </div>\n          </div>\n\n          {/* Task Internal Execution Time Breakdown */}\n          <div className=\"space-y-3\">\n            <h3 className=\"text-muted-foreground text-xs font-semibold\">\n              Task Execution Phase Breakdown (Average per Task)\n            </h3>\n\n            <div className=\"grid grid-cols-2 gap-3 text-xs sm:grid-cols-3 lg:grid-cols-6\">\n              <div className=\"border-border bg-card rounded-lg border p-3\">\n                <span className=\"text-muted-foreground\">CPU Run Time</span>\n                <p className=\"text-foreground mt-1 font-mono text-sm font-semibold\">\n                  {{ ...selectedStage.taskBreakdown }.executorRunTime}\n                </p>\n                <span className=\"text-muted-foreground text-xs\">Active calculation</span>\n              </div>\n\n              <div className=\"border-border bg-card rounded-lg border p-3\">\n                <span className=\"text-muted-foreground\">JVM GC Overhead</span>\n                <p className=\"text-chart-1 mt-1 font-mono text-sm font-semibold\">\n                  {selectedStage.taskBreakdown.jvmGcTime}\n                </p>\n                <span className=\"text-muted-foreground text-xs\">Young Gen sweeps</span>\n              </div>\n\n              <div className=\"border-border bg-card rounded-lg border p-3\">\n                <span className=\"text-muted-foreground\">Shuffle Fetch Wait</span>\n                <p className=\"text-info mt-1 font-mono text-sm font-semibold\">\n                  {selectedStage.taskBreakdown.shuffleFetchWait}\n                </p>\n                <span className=\"text-muted-foreground text-xs\">Network remote blocks</span>\n              </div>\n\n              <div className=\"border-border bg-card rounded-lg border p-3\">\n                <span className=\"text-muted-foreground\">Deserialization</span>\n                <p className=\"text-foreground mt-1 font-mono text-sm font-semibold\">\n                  {selectedStage.taskBreakdown.deserializationTime}\n                </p>\n                <span className=\"text-muted-foreground text-xs\">Task definition</span>\n              </div>\n\n              <div className=\"border-border bg-card rounded-lg border p-3\">\n                <span className=\"text-muted-foreground\">Result Serialization</span>\n                <p className=\"text-foreground mt-1 font-mono text-sm font-semibold\">\n                  {selectedStage.taskBreakdown.serializationTime}\n                </p>\n                <span className=\"text-muted-foreground text-xs\">Map output buffers</span>\n              </div>\n\n              <div className=\"border-border bg-card rounded-lg border p-3\">\n                <span className=\"text-muted-foreground\">Peak Memory</span>\n                <p className=\"text-warning mt-1 font-mono text-sm font-semibold\">\n                  {selectedStage.taskBreakdown.peakMemory}\n                </p>\n                <span className=\"text-muted-foreground text-xs\">Off-heap aggregate</span>\n              </div>\n            </div>\n          </div>\n        </CardContent>\n      </Card>\n    </TabsContent>\n  )\n}\n",
      "type": "registry:page",
      "target": "~/components/blocks/SparkStageSkewTab.tsx"
    },
    {
      "path": "packages/registry-react/blocks/spark-job-stage-visualizer/SparkExecutorsAqe.tsx",
      "content": "import * as React from 'react'\nimport { Badge } from '@/components/ui/badge'\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'\nimport { Progress } from '@/components/ui/progress'\nimport { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'\nimport { TabsContent } from '@/components/ui/tabs'\nimport { Server, Zap } from 'lucide-react'\nimport type { AqeRule, SparkExecutor } from './spark-stage-types'\n\nconst defaultExecutors: SparkExecutor[] = [\n  {\n    id: 'driver',\n    host: '10.0.12.4',\n    role: 'driver',\n    status: 'active',\n    cores: 16,\n    memoryUsedGB: 24.2,\n    memoryTotalGB: 32,\n    memoryPercent: 75.6,\n    gcTimeSec: 4.2,\n    gcPercent: 1.8,\n    tasksCompleted: 285,\n    tasksTotal: 285,\n    tasksFailed: 0,\n    shuffleReadGB: 10.8,\n    shuffleWriteGB: 10.8,\n    spillGB: 0.36,\n  },\n  {\n    id: 'exec-1',\n    host: '10.0.12.18',\n    role: 'executor',\n    status: 'active',\n    cores: 32,\n    memoryUsedGB: 28.8,\n    memoryTotalGB: 32,\n    memoryPercent: 90.0,\n    gcTimeSec: 5.1,\n    gcPercent: 2.2,\n    tasksCompleted: 284,\n    tasksTotal: 284,\n    tasksFailed: 0,\n    shuffleReadGB: 11.2,\n    shuffleWriteGB: 11.2,\n    spillGB: 0.42,\n  },\n  {\n    id: 'exec-2',\n    host: '10.0.12.29',\n    role: 'executor',\n    status: 'active',\n    cores: 32,\n    memoryUsedGB: 21.4,\n    memoryTotalGB: 32,\n    memoryPercent: 66.8,\n    gcTimeSec: 4.8,\n    gcPercent: 2.3,\n    tasksCompleted: 286,\n    tasksTotal: 286,\n    tasksFailed: 0,\n    shuffleReadGB: 10.4,\n    shuffleWriteGB: 10.4,\n    spillGB: 0.34,\n  },\n  {\n    id: 'exec-3',\n    host: '10.0.12.44',\n    role: 'executor',\n    status: 'active',\n    cores: 32,\n    memoryUsedGB: 18.6,\n    memoryTotalGB: 32,\n    memoryPercent: 58.1,\n    gcTimeSec: 4.3,\n    gcPercent: 2.1,\n    tasksCompleted: 285,\n    tasksTotal: 285,\n    tasksFailed: 0,\n    shuffleReadGB: 10.4,\n    shuffleWriteGB: 10.4,\n    spillGB: 0.36,\n  },\n]\n\nconst defaultAqeRules: AqeRule[] = [\n  {\n    id: 'aqe-1',\n    name: 'CoalesceShufflePartitions',\n    status: 'applied',\n    description:\n      'Coalesced 540 initial map partitions down to 200 target shuffle partitions based on target partition size (64 MB).',\n    impact: 'Reduced network RPC overhead by 63% and avoided 340 small shuffle partition files.',\n  },\n  {\n    id: 'aqe-2',\n    name: 'OptimizeSkewedJoin',\n    status: 'applied',\n    description: 'Dynamic skew detection evaluated all 200 partition sizes against the 5x median threshold.',\n    impact: 'Max partition skew ratio remained well balanced at 1.18x. No partition splitting required.',\n  },\n  {\n    id: 'aqe-3',\n    name: 'DemoteBroadcastHashJoin',\n    status: 'skipped',\n    description: 'Evaluated right dimension relation size (3.1 GB) against auto-broadcast threshold (10 MB).',\n    impact: 'Relation exceeded broadcast threshold; preserved robust SortMergeJoin strategy.',\n  },\n  {\n    id: 'aqe-4',\n    name: 'EliminateSubqueryAliases',\n    status: 'applied',\n    description: 'Inlined and pruned unused redundant subquery attribute references from execution DAG.',\n    impact: 'Streamlined Catalyst physical plan tree depth from 14 nodes down to 8 nodes.',\n  },\n]\n\nexport function SparkExecutorsAqe() {\n  return (\n    <>\n      {/* TAB 3: EXECUTORS TELEMETRY (4 NODES) */}\n      <TabsContent value=\"executors\" className=\"space-y-6 focus-visible:outline-none\">\n        <Card className=\"border-border shadow-xs\">\n          <CardHeader className=\"border-border/60 border-b pb-4\">\n            <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between\">\n              <div>\n                <CardTitle className=\"text-base font-semibold\">\n                  Active Cluster Executors (4 Nodes · 112 Cores Total)\n                </CardTitle>\n                <CardDescription className=\"text-xs\">\n                  Real-time worker telemetry: CPU utilization, JVM heap memory, garbage collection pauses, and task\n                  throughput.\n                </CardDescription>\n              </div>\n\n              <div className=\"flex flex-wrap items-center gap-2\">\n                <Badge wrap variant=\"outline\" className=\"font-mono text-xs\">\n                  Total Memory: 93.0 / 128 GB (72.7%)\n                </Badge>\n                <Badge wrap variant=\"success\" className=\"text-xs\">\n                  4/4 Nodes Active\n                </Badge>\n              </div>\n            </div>\n          </CardHeader>\n\n          <CardContent className=\"p-0\">\n            <div className=\"overflow-x-auto\">\n              <Table>\n                <TableHeader>\n                  <TableRow className=\"hover:bg-transparent\">\n                    <TableHead className=\"text-xs font-semibold\">Executor ID & Host</TableHead>\n                    <TableHead className=\"text-xs font-semibold\">Role & Status</TableHead>\n                    <TableHead className=\"text-xs font-semibold\">Cores</TableHead>\n                    <TableHead className=\"text-xs font-semibold\">Memory Used</TableHead>\n                    <TableHead className=\"text-xs font-semibold\">GC Pause Time</TableHead>\n                    <TableHead className=\"text-xs font-semibold\">Tasks Completed</TableHead>\n                    <TableHead className=\"text-xs font-semibold\">Shuffle I/O</TableHead>\n                    <TableHead className=\"text-xs font-semibold\">Memory Spill</TableHead>\n                  </TableRow>\n                </TableHeader>\n                <TableBody>\n                  {defaultExecutors.map((exec) => (\n                    <TableRow key={exec.id} className=\"text-xs\">\n                      {/* Executor ID & Host */}\n                      <TableCell className=\"font-medium\">\n                        <div className=\"flex flex-wrap items-center gap-2\">\n                          <Server className=\"text-muted-foreground size-4\" />\n                          <div>\n                            <div className=\"text-foreground font-mono font-semibold\">{exec.id}</div>\n                            <div className=\"text-muted-foreground font-mono\">{exec.host}</div>\n                          </div>\n                        </div>\n                      </TableCell>\n\n                      {/* Role & Status */}\n                      <TableCell>\n                        <div className=\"flex items-center gap-1.5\">\n                          <Badge\n                            wrap\n                            variant={exec.role === 'driver' ? 'secondary' : 'outline'}\n                            className=\"font-mono text-xs capitalize\"\n                          >\n                            {exec.role}\n                          </Badge>\n                          <span className=\"bg-success inline-block size-2 rounded-full\" />\n                        </div>\n                      </TableCell>\n\n                      {/* Cores */}\n                      <TableCell className=\"font-mono tabular-nums\">{exec.cores} cores</TableCell>\n\n                      {/* Memory Used */}\n                      <TableCell>\n                        <div className=\"min-w-[140px] space-y-1\">\n                          <div className=\"flex items-center justify-between font-mono text-xs\">\n                            <span>\n                              {exec.memoryUsedGB} / {exec.memoryTotalGB} GB\n                            </span>\n                            <span\n                              className={\n                                exec.memoryPercent > 85 ? 'text-warning font-semibold' : 'text-muted-foreground'\n                              }\n                            >\n                              {exec.memoryPercent}%\n                            </span>\n                          </div>\n                          <Progress value={exec.memoryPercent} className=\"h-1.5\" />\n                        </div>\n                      </TableCell>\n\n                      {/* GC Time */}\n                      <TableCell className=\"font-mono tabular-nums\">\n                        <div className=\"flex items-center gap-1.5\">\n                          <Badge wrap variant=\"success\" className=\"font-mono text-xs\">\n                            {exec.gcTimeSec}s ({exec.gcPercent}%)\n                          </Badge>\n                        </div>\n                      </TableCell>\n\n                      {/* Tasks Completed */}\n                      <TableCell className=\"font-mono tabular-nums\">\n                        <span className=\"text-foreground font-medium\">{exec.tasksCompleted}</span>\n                        <span className=\"text-muted-foreground\"> / {exec.tasksTotal}</span>\n                        <span className=\"text-success ml-1\">(0 failed)</span>\n                      </TableCell>\n\n                      {/* Shuffle I/O */}\n                      <TableCell className=\"font-mono tabular-nums\">{exec.shuffleReadGB} GB</TableCell>\n\n                      {/* Spill */}\n                      <TableCell className=\"text-muted-foreground font-mono tabular-nums\">{exec.spillGB} GB</TableCell>\n                    </TableRow>\n                  ))}\n                </TableBody>\n              </Table>\n            </div>\n          </CardContent>\n        </Card>\n      </TabsContent>\n\n      {/* TAB 4: AQE OPTIMIZATION RULES */}\n      <TabsContent value=\"aqe\" className=\"space-y-6 focus-visible:outline-none\">\n        <Card className=\"border-border shadow-xs\">\n          <CardHeader className=\"border-border/60 border-b pb-4\">\n            <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between\">\n              <div>\n                <CardTitle className=\"text-base font-semibold\">Adaptive Query Execution (AQE) Rules Engine</CardTitle>\n                <CardDescription className=\"text-xs\">\n                  Runtime Catalyst optimizer decisions made dynamically based on actual stage map output partition\n                  statistics.\n                </CardDescription>\n              </div>\n\n              <Badge wrap variant=\"success\" className=\"font-mono text-xs\">\n                AQE Status: Active (3 Rules Applied)\n              </Badge>\n            </div>\n          </CardHeader>\n\n          <CardContent className=\"p-6\">\n            <div className=\"grid grid-cols-1 gap-4 md:grid-cols-2\">\n              {defaultAqeRules.map((rule) => (\n                <div key={rule.id} className=\"border-border bg-card space-y-3 rounded-xl border p-4\">\n                  <div className=\"flex items-center justify-between\">\n                    <div className=\"flex flex-wrap items-center gap-2\">\n                      <Zap className=\"text-warning size-4\" />\n                      <span className=\"text-foreground font-mono text-sm font-semibold\">{rule.name}</span>\n                    </div>\n                    <Badge\n                      wrap\n                      variant={rule.status === 'applied' ? 'success' : 'outline'}\n                      className=\"text-xs capitalize\"\n                    >\n                      {rule.status}\n                    </Badge>\n                  </div>\n\n                  <p className=\"text-muted-foreground text-xs\">{rule.description}</p>\n\n                  <div className=\"border-border/60 bg-muted/40 rounded-md border p-2.5 text-xs\">\n                    <span className=\"text-foreground font-medium\">Query Plan Impact: </span>\n                    <span className=\"text-muted-foreground\">{rule.impact}</span>\n                  </div>\n                </div>\n              ))}\n            </div>\n          </CardContent>\n        </Card>\n      </TabsContent>\n    </>\n  )\n}\n",
      "type": "registry:page",
      "target": "~/components/blocks/SparkExecutorsAqe.tsx"
    },
    {
      "path": "packages/registry-react/blocks/spark-job-stage-visualizer/spark-stage-data.ts",
      "content": "import type { SparkStage } from './spark-stage-types'\n\nexport function getQuantilePosition(val: number, max: number = 5.0): number {\n  return Math.min(100, Math.max(0, (val / max) * 100))\n}\n\nexport const defaultStages: SparkStage[] = [\n  {\n    id: 0,\n    name: 'FileScan parquet',\n    callSite: 'spark.read.parquet(\"s3://warehouse/customer_transactions\")',\n    operator: 'FileScan parquet default.customer_transactions [customer_id#42, amount#43, txn_date#44]',\n    status: 'succeeded',\n    tasksTotal: 540,\n    tasksSucceeded: 540,\n    tasksFailed: 0,\n    duration: '18s',\n    durationSec: 18,\n    inputBytes: '14.2 GB',\n    inputRecords: '14,820,400',\n    outputBytes: '14.2 GB',\n    outputRecords: '14,820,400',\n    shuffleReadBytes: '0 B',\n    shuffleWriteBytes: '0 B',\n    spillMemory: '0 B',\n    spillDisk: '0 B',\n    skewRatio: 1.12,\n    quantiles: { min: 0.8, p25: 1.2, median: 1.6, p75: 1.8, p95: 2.0, max: 2.1 },\n    taskBreakdown: {\n      executorRunTime: '1.52s',\n      jvmGcTime: '32ms',\n      shuffleFetchWait: '0ms',\n      serializationTime: '14ms',\n      deserializationTime: '28ms',\n      peakMemory: '128 MB',\n    },\n    details:\n      'Read partitioned parquet files from AWS S3 bucket s3://warehouse/customer_transactions. Pushed filters: [IsNotNull(customer_id), GreaterThanOrEqual(txn_date, 2026-01-01)].',\n    upstreamStageIds: [],\n    downstreamStageIds: [1],\n    branch: 'left',\n  },\n  {\n    id: 1,\n    name: 'Exchange hashpartitioning',\n    callSite: 'df.repartitionByRange(200, col(\"customer_id\"))',\n    operator: 'Exchange hashpartitioning(customer_id#42, 200), ENSURE_REQUIREMENTS, [plan_id=108]',\n    status: 'succeeded',\n    tasksTotal: 200,\n    tasksSucceeded: 200,\n    tasksFailed: 0,\n    duration: '42s',\n    durationSec: 42,\n    inputBytes: '0 B',\n    inputRecords: '14,820,400',\n    outputBytes: '8.4 GB',\n    outputRecords: '14,820,400',\n    shuffleReadBytes: '14.2 GB',\n    shuffleWriteBytes: '8.4 GB',\n    spillMemory: '0 B',\n    spillDisk: '0 B',\n    skewRatio: 1.15,\n    quantiles: { min: 1.8, p25: 2.4, median: 2.9, p75: 3.2, p95: 3.4, max: 3.6 },\n    taskBreakdown: {\n      executorRunTime: '2.74s',\n      jvmGcTime: '58ms',\n      shuffleFetchWait: '92ms',\n      serializationTime: '18ms',\n      deserializationTime: '22ms',\n      peakMemory: '240 MB',\n    },\n    details:\n      'Shuffle exchange hash-partitioning 14.82M rows across 200 AQE-coalesced partition buckets based on Murmur3 hash of customer_id column.',\n    upstreamStageIds: [0],\n    downstreamStageIds: [2],\n    branch: 'left',\n  },\n  {\n    id: 2,\n    name: 'HashAggregate & Filter',\n    callSite: 'df.groupBy(\"customer_id\").agg(sum(\"amount\").as(\"total_spend\"), count(\"txn_id\").as(\"tx_count\"))',\n    operator: 'HashAggregate(keys=[customer_id#42], functions=[sum(amount#43), count(txn_id#45)])',\n    status: 'succeeded',\n    tasksTotal: 200,\n    tasksSucceeded: 200,\n    tasksFailed: 0,\n    duration: '1m 12s',\n    durationSec: 72,\n    inputBytes: '0 B',\n    inputRecords: '14,820,400',\n    outputBytes: '4.6 GB',\n    outputRecords: '1,480,000',\n    shuffleReadBytes: '8.4 GB',\n    shuffleWriteBytes: '4.6 GB',\n    spillMemory: '420 MB',\n    spillDisk: '0 B',\n    skewRatio: 1.18,\n    quantiles: { min: 2.1, p25: 2.8, median: 3.5, p75: 3.9, p95: 4.1, max: 4.2 },\n    taskBreakdown: {\n      executorRunTime: '3.42s',\n      jvmGcTime: '74ms',\n      shuffleFetchWait: '110ms',\n      serializationTime: '14ms',\n      deserializationTime: '24ms',\n      peakMemory: '342 MB',\n    },\n    details:\n      'Aggregated raw transaction events down to 1.48M unique customer lifetime metrics. In-memory hash aggregation spilled 420 MB into JVM execution memory off-heap storage.',\n    upstreamStageIds: [1],\n    downstreamStageIds: [3],\n    branch: 'left',\n  },\n  {\n    id: 4,\n    name: 'FileScan customer_dim',\n    callSite: 'spark.read.parquet(\"s3://warehouse/customer_dim\")',\n    operator: 'FileScan parquet default.customer_dim [customer_id#98, full_name#99, tier#100, signup_date#101]',\n    status: 'succeeded',\n    tasksTotal: 120,\n    tasksSucceeded: 120,\n    tasksFailed: 0,\n    duration: '12s',\n    durationSec: 12,\n    inputBytes: '3.1 GB',\n    inputRecords: '2,400,000',\n    outputBytes: '3.1 GB',\n    outputRecords: '2,400,000',\n    shuffleReadBytes: '0 B',\n    shuffleWriteBytes: '0 B',\n    spillMemory: '0 B',\n    spillDisk: '0 B',\n    skewRatio: 1.09,\n    quantiles: { min: 0.6, p25: 0.9, median: 1.1, p75: 1.3, p95: 1.4, max: 1.5 },\n    taskBreakdown: {\n      executorRunTime: '1.04s',\n      jvmGcTime: '22ms',\n      shuffleFetchWait: '0ms',\n      serializationTime: '10ms',\n      deserializationTime: '18ms',\n      peakMemory: '96 MB',\n    },\n    details: 'Read customer demographic and subscription tier metadata from AWS S3 parquet catalog.',\n    upstreamStageIds: [],\n    downstreamStageIds: [5],\n    branch: 'right',\n  },\n  {\n    id: 5,\n    name: 'Exchange customer_dim',\n    callSite: 'customerDim.repartition(200, col(\"customer_id\"))',\n    operator: 'Exchange hashpartitioning(customer_id#98, 200), ENSURE_REQUIREMENTS, [plan_id=142]',\n    status: 'succeeded',\n    tasksTotal: 120,\n    tasksSucceeded: 120,\n    tasksFailed: 0,\n    duration: '16s',\n    durationSec: 16,\n    inputBytes: '0 B',\n    inputRecords: '2,400,000',\n    outputBytes: '3.1 GB',\n    outputRecords: '2,400,000',\n    shuffleReadBytes: '3.1 GB',\n    shuffleWriteBytes: '3.1 GB',\n    spillMemory: '0 B',\n    spillDisk: '0 B',\n    skewRatio: 1.11,\n    quantiles: { min: 0.8, p25: 1.1, median: 1.3, p75: 1.5, p95: 1.7, max: 1.8 },\n    taskBreakdown: {\n      executorRunTime: '1.24s',\n      jvmGcTime: '26ms',\n      shuffleFetchWait: '48ms',\n      serializationTime: '12ms',\n      deserializationTime: '16ms',\n      peakMemory: '160 MB',\n    },\n    details:\n      'Shuffle partitioned customer dimension records across 200 partitions matching left transaction dataset partition key.',\n    upstreamStageIds: [4],\n    downstreamStageIds: [3],\n    branch: 'right',\n  },\n  {\n    id: 3,\n    name: 'SortMergeJoin',\n    callSite: 'txnAgg.join(customerDim, col(\"customer_id#42\") === col(\"customer_id#98\"), \"inner\")',\n    operator: 'SortMergeJoin [customer_id#42], [customer_id#98], Inner',\n    status: 'succeeded',\n    tasksTotal: 200,\n    tasksSucceeded: 200,\n    tasksFailed: 0,\n    duration: '1m 20s',\n    durationSec: 80,\n    inputBytes: '0 B',\n    inputRecords: '1,480,000',\n    outputBytes: '29.8 GB',\n    outputRecords: '1,240,000 (Joined 14.8M keys)',\n    shuffleReadBytes: '7.7 GB',\n    shuffleWriteBytes: '29.8 GB',\n    spillMemory: '1.06 GB',\n    spillDisk: '0 B',\n    skewRatio: 1.21,\n    quantiles: { min: 2.4, p25: 3.1, median: 3.8, p75: 4.3, p95: 4.6, max: 4.8 },\n    taskBreakdown: {\n      executorRunTime: '3.72s',\n      jvmGcTime: '82ms',\n      shuffleFetchWait: '140ms',\n      serializationTime: '22ms',\n      deserializationTime: '32ms',\n      peakMemory: '480 MB',\n    },\n    details:\n      'Executed distributed SortMergeJoin matching customer_id keys across left aggregated metrics and right dimension tables. AQE coalesced skewed partitions and eliminated full table broadcast risk.',\n    upstreamStageIds: [2, 5],\n    downstreamStageIds: [],\n    branch: 'join',\n  },\n]\n",
      "type": "registry:page",
      "target": "~/components/blocks/spark-stage-data.ts"
    },
    {
      "path": "packages/registry-react/blocks/spark-job-stage-visualizer/spark-stage-types.ts",
      "content": "export type StageStatus = 'succeeded' | 'running' | 'failed' | 'pending'\nexport type ExecutorStatus = 'active' | 'dead' | 'excluded'\n\nexport interface TaskQuantiles {\n  min: number\n  p25: number\n  median: number\n  p75: number\n  p95: number\n  max: number\n}\n\nexport interface TaskBreakdownMetrics {\n  executorRunTime: string\n  jvmGcTime: string\n  shuffleFetchWait: string\n  serializationTime: string\n  deserializationTime: string\n  peakMemory: string\n}\n\nexport interface SparkStage {\n  id: number\n  name: string\n  callSite: string\n  operator: string\n  status: StageStatus\n  tasksTotal: number\n  tasksSucceeded: number\n  tasksFailed: number\n  duration: string\n  durationSec: number\n  inputBytes: string\n  inputRecords: string\n  outputBytes: string\n  outputRecords: string\n  shuffleReadBytes: string\n  shuffleWriteBytes: string\n  spillMemory: string\n  spillDisk: string\n  skewRatio: number\n  quantiles: TaskQuantiles\n  taskBreakdown: TaskBreakdownMetrics\n  details: string\n  upstreamStageIds: number[]\n  downstreamStageIds: number[]\n  branch: 'left' | 'right' | 'join'\n}\n\nexport interface SparkExecutor {\n  id: string\n  host: string\n  role: 'driver' | 'executor'\n  status: ExecutorStatus\n  cores: number\n  memoryUsedGB: number\n  memoryTotalGB: number\n  memoryPercent: number\n  gcTimeSec: number\n  gcPercent: number\n  tasksCompleted: number\n  tasksTotal: number\n  tasksFailed: number\n  shuffleReadGB: number\n  shuffleWriteGB: number\n  spillGB: number\n}\n\nexport interface AqeRule {\n  id: string\n  name: string\n  status: 'applied' | 'skipped'\n  description: string\n  impact: string\n}\n",
      "type": "registry:page",
      "target": "~/components/blocks/spark-stage-types.ts"
    }
  ],
  "dependencies": [
    "lucide-react"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://uipkge.dev/r/react/badge.json",
    "https://uipkge.dev/r/react/button.json",
    "https://uipkge.dev/r/react/card.json",
    "https://uipkge.dev/r/react/progress.json",
    "https://uipkge.dev/r/react/table.json",
    "https://uipkge.dev/r/react/tabs.json"
  ],
  "description": "Databricks and Apache Spark distributed job execution DAG visualizer with stage performance metrics, task skew distribution quantiles, and executor JVM GC telemetry.",
  "categories": [
    "devops",
    "dashboard",
    "analytics",
    "data",
    "app"
  ]
}