Bug #108754 Explain analyze with union query
Submitted: 12 Oct 2022 12:16 Modified: 12 Oct 2022 12:54
Reporter: Pedro Ferreira Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S6 (Debug Builds)
Version:8.0.31 OS:Ubuntu (22.04)
Assigned to: CPU Architecture:x86 (x86_64)
Tags: ANALYSE, explain, json, UNION

[12 Oct 2022 12:16] Pedro Ferreira
Description:
The following query:

EXPLAIN ANALYZE FORMAT = JSON (SELECT 1) UNION (SELECT 2);

Triggers an assertion error at opt_explain.cc:2084

assert(ret || !explain_thd->is_error());

The compilation parameters are the same as issue 108148:

-DWITH_DEBUG=1 -DWITH_ASAN=ON -DWITH_UBSAN=ON and boost library version 1.77

I think an error is missing because a simple query will trigger the error JSON format not being compatible with ANALYZE at the moment.

How to repeat:
Run the query above.
[12 Oct 2022 12:54] MySQL Verification Team
Hello Pedro Ferreira,

Thank you for the report and feedback.
Observed that 8.0.31 debug build is affected.

regards,
Umesh
[12 Oct 2022 12:55] MySQL Verification Team
- 8.0.31 debug build

./mtr bug108754 --nocheck-testcases --debug-server
Logging: ./mtr  bug108754 --nocheck-testcases --debug-server
MySQL Version 8.0.31
Checking supported features
 - Binaries are debug compiled
Using 'all' suites
Collecting tests
Checking leftover processes
Removing old var directory
Creating var directory '/export/home/tmp/ushastry/mysql-8.0.31/mysql-test/var'
Installing system database
Using parallel: 1

==============================================================================
                  TEST NAME                       RESULT  TIME (ms) COMMENT
------------------------------------------------------------------------------
EXPLAIN ANALYZE FORMAT = JSON (SELECT 1) UNION (SELECT 2);
[ 50%] main.bug108754                            [ fail ]
        Test ended at 2022-10-12 14:54:25

CURRENT_TEST: main.bug108754
mysqltest: At line 1: Query 'EXPLAIN ANALYZE FORMAT = JSON (SELECT 1) UNION (SELECT 2)' failed.
ERROR 2013 (HY000): Lost connection to MySQL server during query