Does TiDB execution plan in dot format not support CTE? Bug?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiDB 执行计划dot格式不支持cte?bug?

| username: ShawnYan

【TiDB Usage Environment】Production, Testing, Research
【TiDB Version】tidb 6.1
【Encountered Problem】Does tidb explain format = "dot" not support CTE? Is this a bug?
【Reproduction Path】What operations were performed to encounter the problem

Test SQL: 公共表表达式 (CTE) | PingCAP 文档中心

explain format = "dot"
WITH top_50_eldest_authors_cte AS (
    SELECT a.id, a.name, (IFNULL(a.death_year, YEAR(NOW())) - a.birth_year) AS age
    FROM authors a
    ORDER BY age DESC
    LIMIT 50
)
SELECT
    ANY_VALUE(ta.id) AS author_id,
    ANY_VALUE(ta.age) AS author_age,
    ANY_VALUE(ta.name) AS author_name,
    COUNT(*) AS books
FROM top_50_eldest_authors_cte ta
LEFT JOIN book_authors ba ON ta.id = ba.author_id
GROUP BY ta.id
\G

*************************** 1. row ***************************
dot contents:
digraph Projection_23 {
subgraph cluster23{
node [style=filled, color=lightgrey]
color=black
label = "root"
"Projection_23" -> "HashAgg_24"
"HashAgg_24" -> "HashJoin_26"
"HashJoin_26" -> "CTEFullScan_30"
"HashJoin_26" -> "TableReader_29"
}
subgraph cluster28{
node [style=filled, color=lightgrey]
color=black
label = "cop"
"TableFullScan_28"
}
"TableReader_29" -> "TableFullScan_28"
}

1 row in set (0.01 sec)

【Problem Phenomenon and Impact】

The result only got └─TableFullScan_28, but did not include └─TopN_18 / └─TableFullScan_17

【Attachments】

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: yilong | Original post link

I have recorded an issue, you can follow it. Explain Format = "dot" does not show CTE · Issue #37401 · pingcap/tidb · GitHub

| username: ShawnYan | Original post link

Subscribed to the issue, thanks.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.