(props)
| 241 | } |
| 242 | |
| 243 | function View(props) { |
| 244 | const [stats, setStats] = useState(null); |
| 245 | const [operators, setOperators] = useState(null); |
| 246 | const [channels, setChannels] = useState(null); |
| 247 | const [view, setView] = useState(null); |
| 248 | const [graph, setGraph] = useState(null); |
| 249 | const [dot, setDot] = useState(null); |
| 250 | const [loading, setLoading] = useState(true); |
| 251 | const [error, setError] = useState(false); |
| 252 | |
| 253 | useEffect(() => { |
| 254 | setLoading(true); |
| 255 | setError(false); |
| 256 | setGraph(null); |
| 257 | |
| 258 | const load = async () => { |
| 259 | // Use mz_dataflow_operator_parents for hierarchy - much cleaner than computing from addresses. |
| 260 | // The query computes: |
| 261 | // 1. All operators in the dataflow with their parent_id |
| 262 | // 2. Which operators are scopes (have children) |
| 263 | // 3. Memory and elapsed time stats |
| 264 | // 4. All addresses (operators + channels) for edge lookups |
| 265 | const { |
| 266 | results: [_set_cluster, _set_replica, stats_table, operators_table, addresses_table, channels_table], |
| 267 | } = await query(` |
| 268 | SET cluster = ${formatNameForQuery(props.clusterName)}; |
| 269 | SET cluster_replica = ${formatNameForQuery(props.replicaName)}; |
| 270 | |
| 271 | -- Dataflow stats |
| 272 | SELECT |
| 273 | name, batches, records, size |
| 274 | FROM |
| 275 | mz_introspection.mz_records_per_dataflow |
| 276 | WHERE |
| 277 | id = ${props.dataflowId}; |
| 278 | |
| 279 | -- All operators with parent relationships, scope detection, and stats |
| 280 | WITH dataflow_operators AS ( |
| 281 | SELECT |
| 282 | o.id, |
| 283 | o.name, |
| 284 | p.parent_id, |
| 285 | a.address |
| 286 | FROM mz_introspection.mz_dataflow_operators o |
| 287 | LEFT JOIN mz_introspection.mz_dataflow_operator_parents p ON o.id = p.id |
| 288 | JOIN mz_introspection.mz_dataflow_addresses a ON o.id = a.id |
| 289 | WHERE a.address[1] = ${props.dataflowId} |
| 290 | ), |
| 291 | scope_ids AS ( |
| 292 | SELECT DISTINCT parent_id as id FROM dataflow_operators WHERE parent_id IS NOT NULL |
| 293 | ) |
| 294 | SELECT |
| 295 | o.id, |
| 296 | o.name, |
| 297 | o.parent_id, |
| 298 | o.address, |
| 299 | CASE WHEN s.id IS NOT NULL THEN true ELSE false END as is_scope, |
| 300 | r.records, |
nothing calls this directly
no test coverage detected