【TiDB 版本】: 5.0.0
【问题描述】:
在v5.0.0集群 嘗試EXPLAIN以下SQL語句時,導致ERROR 2006 (HY000): MySQL server has gone away
最後出現Error Code: 1105. runtime error: index out of range [-1]
但在v4.0.12版本是可以正常返回Resultset
SELECT
pt
.code
,
pt
.name
,
IFNULL(SUM(tmp
.order_xxx_count
), 0) AS order_xxx_count
,
CASE
WHEN tmp
.product_type
IS NULL THEN 0
ELSE SUM(tmp
.point
)
END AS point
,
CASE
WHEN tmp
.product_type
IS NULL THEN 0
ELSE SUM(total
)
END AS total
,
CASE
WHEN tmp
.product_type
IS NULL THEN 0
ELSE (SUM(total
) - SUM(earning
))
END AS earning
FROM
(SELECT
code
, name
, channel_code
FROM
product
) AS pt
LEFT JOIN
(SELECT
channel_code
,
product_type
,
memxxx_login
,
COUNT(1) order_xxx_count
,
SUM(point
) point
,
SUM(total
) total
,
SUM(earning
) earning
FROM
order_xxx
LEFT JOIN view_xxxxxxxx
ON view_xxxxxxxx
.member
= order_xxx
.memxxx_login
WHERE
1 = 1 AND order_xxx
.status
= 1
AND order_xxx
.payout
= 1
AND (IFNULL(“2021-03-01 04:00”, 1) = 1 OR order_xxx
.payout_time
>= “2021-03-01 04:00”)
AND (IFNULL(“2021-04-01 04:00”, 1) = 1 OR order_xxx
.payout_time
< “2021-04-01 04:00”)
AND (IFNULL(NULL, 1) = 1 OR order_xxx
.memxxx_login
= NULL)
AND (IFNULL(NULL, 1) = 1 OR FIND_IN_SET(view_xxxxxxxx
.shxxx_login
, NULL))
AND (IFNULL(NULL, 1) = 1 OR view_xxxxxxxx
.general_agent
IS NULL)
AND (IFNULL(NULL, 1) = 1 OR view_xxxxxxxx
.agent
IS NULL)
GROUP BY memxxx_login
, product_type
, channel_code
) AS tmp
ON tmp
.product_type
= pt
.code
AND tmp
.channel_code
= pt
.channel_code
WHERE
(IFNULL(NULL, 1) = 1 OR pt
.code
= NULL)
AND (IFNULL(“abc123”, 1) = 1 OR pt
.channel_code
= “abc123”)
GROUP BY pt
.code
, pt
.channel_code
;