1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-4407 and condtion does not work when HWM > columnstore_string_scan_threshold - 1

This commit is contained in:
Denis Khalikov
2021-05-11 22:16:43 +03:00
parent 47e9fc0312
commit 8dd2f2937c
3 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,32 @@
DROP DATABASE IF EXISTS mcol_4407;
CREATE DATABASE mcol_4407;
USE mcol_4407;
DROP TABLE IF EXISTS `sictable`;
/* Bug when HWM > scan_threshold - 1 */
set max_recursive_iterations=6282;
CREATE TABLE `sictable`
(
`serialno` VARCHAR(20) NOT NULL
)
ENGINE=Columnstore
DEFAULT CHARSET=utf8
;
INSERT INTO `sictable` (
with recursive series as (
select 1 as id union all
select id +1 as id from series
where id < 6281)
select lpad(id,11,'0') from series);
SELECT `serialno`
FROM `sictable`
WHERE `serialno` = '00000000029' AND `serialno` = '00000006256';
serialno
SELECT `serialno`
FROM `sictable`
WHERE `serialno` = '00000000029' AND `serialno` = '00000000029';
serialno
00000000029
/* Default value */
set max_recursive_iterations=1000;
DROP TABLE `sictable`;
DROP DATABASE mcol_4407;

View File

@ -0,0 +1,44 @@
--source ../include/have_columnstore.inc
-- disable_warnings
DROP DATABASE IF EXISTS mcol_4407;
-- enable_warnings
CREATE DATABASE mcol_4407;
USE mcol_4407;
-- disable_warnings
DROP TABLE IF EXISTS `sictable`;
-- enable_warnings
/* Bug when HWM > scan_threshold - 1 */
set max_recursive_iterations=6282;
CREATE TABLE `sictable`
(
`serialno` VARCHAR(20) NOT NULL
)
ENGINE=Columnstore
DEFAULT CHARSET=utf8
;
INSERT INTO `sictable` (
with recursive series as (
select 1 as id union all
select id +1 as id from series
where id < 6281)
select lpad(id,11,'0') from series);
SELECT `serialno`
FROM `sictable`
WHERE `serialno` = '00000000029' AND `serialno` = '00000006256';
SELECT `serialno`
FROM `sictable`
WHERE `serialno` = '00000000029' AND `serialno` = '00000000029';
/* Default value */
set max_recursive_iterations=1000;
DROP TABLE `sictable`;
DROP DATABASE mcol_4407;

View File

@ -495,6 +495,24 @@ void PrimitiveProcessor::p_Dictionary(const DictInput* in,
if (eqFilter)
{
// MCOL-4407.
// Support filters:
// `where key = value0 and key = value1 {and key = value2}`
//
// The problem occurs only when HWM > columnstore_string_scan_threshold - 1
// because in this case:
// CS uses `tryCombineDictionary` which combines `DictStep`s into one as result
// `eqFilter` has more than 1 filter and applies the logic below which is `or` by
// default.
// Note: The case HWM <= columnstore_string_scan_threshold - 1 has the same problem,
// function `p_TokenByScan`, but it does not occur because `tryCombineDictionaryScan`
// was turned off.
if (eqFilter->size() > 1 && in->BOP == BOP_AND && eqOp == COMPARE_EQ)
goto no_store;
if (eqFilter->size() > 1 && in->BOP == BOP_OR && eqOp == COMPARE_NE)
goto store;
// MCOL-1246 Trim whitespace before match
string strData((char*)sigptr.data, sigptr.len);
boost::trim_right_if(strData, boost::is_any_of(" "));