You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MDEV-25080 Some fixes:
1. In TupleUnion::writeNull(), add the missing switch case for wide decimal with 16bytes column width. 2. MCOL-5432 Disable complete/partial pushdown of UNION operation if the query involves an ORDER BY or a LIMIT clause, until MCOL-5222 is fixed. Also add MTR test cases for this.
This commit is contained in:
@ -1766,12 +1766,14 @@ void TupleUnion::writeNull(Row* out, uint32_t col)
|
|||||||
{
|
{
|
||||||
case 1: out->setUintField<1>(joblist::TINYINTNULL, col); break;
|
case 1: out->setUintField<1>(joblist::TINYINTNULL, col); break;
|
||||||
|
|
||||||
case 2: out->setUintField<1>(joblist::SMALLINTNULL, col); break;
|
case 2: out->setUintField<2>(joblist::SMALLINTNULL, col); break;
|
||||||
|
|
||||||
case 4: out->setUintField<4>(joblist::INTNULL, col); break;
|
case 4: out->setUintField<4>(joblist::INTNULL, col); break;
|
||||||
|
|
||||||
case 8: out->setUintField<8>(joblist::BIGINTNULL, col); break;
|
case 8: out->setUintField<8>(joblist::BIGINTNULL, col); break;
|
||||||
|
|
||||||
|
case 16: out->setInt128Field(datatypes::Decimal128Null, col); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -779,6 +779,15 @@ select_handler* create_columnstore_select_handler_(THD* thd, SELECT_LEX* sel_lex
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MCOL-5432 Disable partial pushdown of the UNION operation if the query
|
||||||
|
// involves an order by or a limit clause.
|
||||||
|
if (sel_lex && sel_unit &&
|
||||||
|
(sel_unit->global_parameters()->limit_params.explicit_limit == true ||
|
||||||
|
sel_unit->global_parameters()->order_list.elements != 0))
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<SELECT_LEX*> select_lex_vec;
|
std::vector<SELECT_LEX*> select_lex_vec;
|
||||||
|
|
||||||
if (sel_unit && !sel_lex)
|
if (sel_unit && !sel_lex)
|
||||||
@ -1036,13 +1045,23 @@ select_handler* create_columnstore_select_handler(THD* thd, SELECT_LEX* select_l
|
|||||||
select_handler* create_columnstore_unit_handler(THD* thd, SELECT_LEX_UNIT* sel_unit)
|
select_handler* create_columnstore_unit_handler(THD* thd, SELECT_LEX_UNIT* sel_unit)
|
||||||
{
|
{
|
||||||
if (thd->lex->sql_command == SQLCOM_CREATE_VIEW)
|
if (thd->lex->sql_command == SQLCOM_CREATE_VIEW)
|
||||||
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (thd->stmt_arena && thd->stmt_arena->is_stmt_prepare())
|
if (thd->stmt_arena && thd->stmt_arena->is_stmt_prepare())
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MCOL-5432 Disable UNION pushdown if the query involves an order by
|
||||||
|
// or a limit clause.
|
||||||
|
if (sel_unit->global_parameters()->limit_params.explicit_limit == true ||
|
||||||
|
sel_unit->global_parameters()->order_list.elements != 0)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return create_columnstore_select_handler_(thd, 0, sel_unit);
|
return create_columnstore_select_handler_(thd, 0, sel_unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,6 +261,53 @@ NULL PUSHED UNION NULL NULL NULL NULL NULL NULL NULL NULL
|
|||||||
EXECUTE stmt;
|
EXECUTE stmt;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
NULL PUSHED UNION NULL NULL NULL NULL NULL NULL NULL NULL
|
NULL PUSHED UNION NULL NULL NULL NULL NULL NULL NULL NULL
|
||||||
|
# MCOL-5432 Disable UNION pushdown if an ORDER BY or a LIMIT
|
||||||
|
# clause is involved, until MCOL-5222 is fixed.
|
||||||
|
SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a;
|
||||||
|
a
|
||||||
|
abc
|
||||||
|
bcd
|
||||||
|
bcd
|
||||||
|
cde
|
||||||
|
cde
|
||||||
|
def
|
||||||
|
efg
|
||||||
|
EXPLAIN SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2000
|
||||||
|
2 UNION t2 ALL NULL NULL NULL NULL 2000
|
||||||
|
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
|
||||||
|
SELECT * FROM t1 UNION ALL SELECT * FROM t2 LIMIT 3;
|
||||||
|
a
|
||||||
|
abc
|
||||||
|
bcd
|
||||||
|
cde
|
||||||
|
EXPLAIN SELECT * FROM t1 UNION ALL SELECT * FROM t2 LIMIT 3;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2000
|
||||||
|
2 UNION t2 ALL NULL NULL NULL NULL 2000
|
||||||
|
SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a DESC LIMIT 5;
|
||||||
|
a
|
||||||
|
efg
|
||||||
|
def
|
||||||
|
cde
|
||||||
|
cde
|
||||||
|
bcd
|
||||||
|
EXPLAIN SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a DESC LIMIT 5;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2000
|
||||||
|
2 UNION t2 ALL NULL NULL NULL NULL 2000
|
||||||
|
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
|
||||||
|
SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a LIMIT 3 OFFSET 2;
|
||||||
|
a
|
||||||
|
bcd
|
||||||
|
cde
|
||||||
|
cde
|
||||||
|
EXPLAIN SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a LIMIT 3 OFFSET 2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2000
|
||||||
|
2 UNION t2 ALL NULL NULL NULL NULL 2000
|
||||||
|
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
|
||||||
DROP USER 'cejuser'@'localhost';
|
DROP USER 'cejuser'@'localhost';
|
||||||
DROP TABLE t1, t2, t3, t4;
|
DROP TABLE t1, t2, t3, t4;
|
||||||
DROP DATABASE mdev25080;
|
DROP DATABASE mdev25080;
|
||||||
|
@ -169,6 +169,17 @@ PREPARE stmt FROM "EXPLAIN (SELECT * FROM t1 UNION
|
|||||||
EXECUTE stmt;
|
EXECUTE stmt;
|
||||||
EXECUTE stmt;
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
--echo # MCOL-5432 Disable UNION pushdown if an ORDER BY or a LIMIT
|
||||||
|
--echo # clause is involved, until MCOL-5222 is fixed.
|
||||||
|
SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a;
|
||||||
|
EXPLAIN SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a;
|
||||||
|
SELECT * FROM t1 UNION ALL SELECT * FROM t2 LIMIT 3;
|
||||||
|
EXPLAIN SELECT * FROM t1 UNION ALL SELECT * FROM t2 LIMIT 3;
|
||||||
|
SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a DESC LIMIT 5;
|
||||||
|
EXPLAIN SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a DESC LIMIT 5;
|
||||||
|
SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a LIMIT 3 OFFSET 2;
|
||||||
|
EXPLAIN SELECT * FROM t1 UNION ALL SELECT * FROM t2 ORDER BY a LIMIT 3 OFFSET 2;
|
||||||
|
|
||||||
DROP USER 'cejuser'@'localhost';
|
DROP USER 'cejuser'@'localhost';
|
||||||
DROP TABLE t1, t2, t3, t4;
|
DROP TABLE t1, t2, t3, t4;
|
||||||
DROP DATABASE mdev25080;
|
DROP DATABASE mdev25080;
|
||||||
|
Reference in New Issue
Block a user