mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-06 19:06:58 +00:00
`TQL EXPLAIN` used to hand the whole native tree to the fused operator as one multi-line block under a `NativeTree` header, with `root`/`left`/`right`/`input` edge words and every metric pushed onto the operator's own line. A reader could not tell which node spent the time, and `TQL ANALYZE` reported the tree's figures as the operator's. The tree now reads like any other plan: one line per node, two spaces per depth, each node's figures on its own line, and the operator line above them. The walk builds the path the runtime registered each node under, so a node's figures are looked up where they were stored rather than guessed - including `Info`, which binds its operands as `base`/`info` while the kernel registers them as `left`/`right`. A plan that never ran has an empty snapshot and prints structure only, which is what `EXPLAIN` should show. The figures also travel to `TQL ANALYZE FORMAT JSON` as real children, which the text path could not give: the operator registers the tree as one custom metric value, so it survives the region-to-frontend record instead of being re-parsed out of a string. `PlanMetrics` gains that optional field with `serde(default)`, so a record from an older datanode still deserializes. Nothing about execution changed: no new plan nodes, no rewritten tree, and the operator still owns the same metrics set. Signed-off-by: discord9 <discord9@163.com>