From e8f83121d20e2f5035e2e655c17014fbd56d1582 Mon Sep 17 00:00:00 2001 From: Denis Khalikov Date: Sat, 18 Jun 2022 16:39:44 +0300 Subject: [PATCH] [MCOL-4778] Return if we have an error in push_down_init. --- dbcon/mysql/ha_mcs_pushdown.cpp | 3 ++ .../columnstore/bugfixes/mcol-4778.result | 18 ++++++++++++ .../columnstore/bugfixes/mcol-4778.test | 29 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 mysql-test/columnstore/bugfixes/mcol-4778.result create mode 100644 mysql-test/columnstore/bugfixes/mcol-4778.test diff --git a/dbcon/mysql/ha_mcs_pushdown.cpp b/dbcon/mysql/ha_mcs_pushdown.cpp index 619caff4c..2d6c2120c 100644 --- a/dbcon/mysql/ha_mcs_pushdown.cpp +++ b/dbcon/mysql/ha_mcs_pushdown.cpp @@ -962,6 +962,9 @@ select_handler* create_columnstore_select_handler(THD* thd, SELECT_LEX* select_l { my_printf_error(ER_INTERNAL_ERROR, "%s", MYF(0), "Error occured in ha_mcs_impl_pushdown_init()"); } + + // We had an error in `ha_mcs_impl_pushdown_init`, no need to continue execution of this query. + return handler; } // Unset select_lex::first_cond_optimization diff --git a/mysql-test/columnstore/bugfixes/mcol-4778.result b/mysql-test/columnstore/bugfixes/mcol-4778.result new file mode 100644 index 000000000..80c6fdd29 --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol-4778.result @@ -0,0 +1,18 @@ +DROP DATABASE IF EXISTS mcol_4778; +CREATE DATABASE mcol_4778; +USE mcol_4778; +CREATE TABLE bus_routes (origin varchar(50), dst varchar(50)) engine=columnstore; +INSERT INTO bus_routes VALUES +('New York', 'Boston'), +('Boston', 'New York'), +('New York', 'Washington'), +('Washington', 'Boston'), +('Washington', 'Raleigh'); +WITH RECURSIVE bus_dst as ( +SELECT origin as dst FROM bus_routes WHERE origin='New York' + UNION +SELECT bus_routes.dst FROM bus_routes JOIN bus_dst ON bus_dst.dst = bus_routes.origin +) +SELECT * FROM bus_dst; +ERROR 42000: The storage engine for the table doesn't support Recursive CTE +DROP DATABASE mcol_4778; diff --git a/mysql-test/columnstore/bugfixes/mcol-4778.test b/mysql-test/columnstore/bugfixes/mcol-4778.test new file mode 100644 index 000000000..ed8566740 --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol-4778.test @@ -0,0 +1,29 @@ +# +# MCOL-4778 Recursive CTE Crashing MariaDB - fix crash produce err. +# +-- source ../include/have_columnstore.inc + +--disable_warnings +DROP DATABASE IF EXISTS mcol_4778; +--enable_warnings +CREATE DATABASE mcol_4778; +USE mcol_4778; + +CREATE TABLE bus_routes (origin varchar(50), dst varchar(50)) engine=columnstore; + +INSERT INTO bus_routes VALUES + ('New York', 'Boston'), + ('Boston', 'New York'), + ('New York', 'Washington'), + ('Washington', 'Boston'), + ('Washington', 'Raleigh'); + +--error ER_CHECK_NOT_IMPLEMENTED +WITH RECURSIVE bus_dst as ( + SELECT origin as dst FROM bus_routes WHERE origin='New York' + UNION + SELECT bus_routes.dst FROM bus_routes JOIN bus_dst ON bus_dst.dst = bus_routes.origin +) +SELECT * FROM bus_dst; + +DROP DATABASE mcol_4778;