explain format = 'verbose' 与 explain format='VERBOSE' 结果不同,疑似bug?

Bug 反馈
清晰准确地描述您发现的问题,提供任何可能复现问题的步骤有助于研发同学及时处理问题
【 TiDB 版本】

> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v6.0.0
Edition: Community
Git Commit Hash: 36a9810441ca0e496cbd22064af274b3be771081
Git Branch: heads/refs/tags/v6.0.0
UTC Build Time: 2022-03-31 10:33:28
GoVersion: go1.18
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.001 sec)

【 Bug 的影响】
处理不够优雅,连接会中断

【可能的问题复现步骤】

USE test;
DROP TABLE IF EXISTS t;
CREATE TABLE t (id int, dc datetime, cc1 char(20), cc2 char(20));
INSERT INTO t VALUES (1, '2022-05-01 15:33:33', 'UUtJeaV', 'snRXXCZHBPW'), (2, '2022-05-01 15:33:33', 'snRXXCZHBPW', 'UUtJeaV');

explain format = 'verbose' select id, DAYNAME(dc), MONTHNAME(dc) from t;
explain format='VERBOSE' select id, DAYNAME(dc), MONTHNAME(dc) from t;

【看到的非预期行为】

TiDB-v6> explain format = 'verbose' select id, DAYNAME(dc), MONTHNAME(dc) from t;
+-------------------------+----------+-----------+-----------+---------------+-------------------------------------------------------------------------+
| id                      | estRows  | estCost   | task      | access object | operator info                                                           |
+-------------------------+----------+-----------+-----------+---------------+-------------------------------------------------------------------------+
| Projection_3            | 10000.00 | 72852.67  | root      |               | test.t.id, dayname(test.t.dc)->Column#6, monthname(test.t.dc)->Column#7 |
| └─TableReader_5         | 10000.00 | 66834.67  | root      |               | data:TableFullScan_4                                                    |
|   └─TableFullScan_4     | 10000.00 | 840020.00 | cop[tikv] | table:t       | keep order:false, stats:pseudo                                          |
+-------------------------+----------+-----------+-----------+---------------+-------------------------------------------------------------------------+
3 rows in set (0.001 sec)

TiDB-v6> explain format='VERBOSE' select id, DAYNAME(dc), MONTHNAME(dc) from t;
ERROR 1105 (HY000): runtime error: index out of range [0] with length 0
ERROR 2013 (HY000): Lost connection to MySQL server during query
ERROR 2013 (HY000): Lost connection to MySQL server during query

【期望看到的行为】
explain format = 'verbose'explain format='VERBOSE' 查询结果应该一致。

【相关组件及具体版本】

【其他背景信息或者截图】
如集群拓扑,系统和内核版本,应用 app 信息等;如果问题跟 SQL 有关,请提供 SQL 语句和相关表的 Schema 信息;如果节点日志存在关键报错,请提供相关节点的日志内容或文件;如果一些业务敏感信息不便提供,请留下联系方式,我们与您私下沟通。

收到,感谢反馈:grinning::grinning::call_me_hand::call_me_hand:

5.2.3测试结果

mysql> explain format=‘VERBOSE’ select * from t;
ERROR 1105 (HY000): runtime error: index out of range [0] with length 0
mysql>
mysql> explain format=‘verbose’ select * from t;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
mysql> explain format=‘verbose’ select * from t;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect…
Connection id: 733
Current database: test

±----------------------±--------±--------±----------±--------------±---------------------+
| id | estRows | estCost | task | access object | operator info |
±----------------------±--------±--------±----------±--------------±---------------------+
| TableReader_5 | 8.00 | 36.35 | root | | data:TableFullScan_4 |
| └─TableFullScan_4 | 8.00 | 467.00 | cop[tikv] | table:t | keep order:false |
±----------------------±--------±--------±----------±--------------±---------------------+
2 rows in set, 1 warning (0.00 sec)

回复好快,谢谢。

https://github.com/pingcap/tidb/issues/26923

不太一样,#26923 是对支持 format = 'verbose'不够完善

Now explain analyze + format = 'verbose' seems not to be support yet.

而这里表述的是支持小写,但不支持大写 format='VERBOSE' ,细节有差异。

确实,一些实现上的细节没有大小写不敏感,导致返回的 result 上漏了部分数据,导致数组长度错误,多谢纠正。


改成这样就好了

https://github.com/pingcap/tidb/issues/34469 后续可以关注这个 issue

okay, thanks a lot ~

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。