|
Extent ranges are invalid for short character columns. Here is the failing scenario:
MariaDB [test]> create table t1 (a char(5))engine=columnstore;
|
Query OK, 0 rows affected (0.405 sec)
|
|
MariaDB [test]> insert into t1 values ('abc'), ('xyz');
|
Query OK, 2 rows affected (0.200 sec)
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
MariaDB [test]> select * from t1;
|
+------+
|
| a |
|
+------+
|
| abc |
|
| xyz |
|
+------+
|
2 rows in set (0.041 sec)
|
|
MariaDB [test]> select calshowpartitionsbyvalue('t1', 'a', 'aa', 'zz');
|
ERROR 1815 (HY000): Internal error: IDB-2040: No partition found for the given value range.
|
MariaDB [test]> select c.table_schema, c.table_name, c.column_name, e.min_value, e.max_value from information_schema.columnstore_extents e, information_schema.columnstore_columns c where c.table_schema='test' and c.table_name='t1' and c.column_name='a' and c.object_id=e.object_id;
|
+--------------+------------+-------------+-----------+-----------+
|
| table_schema | table_name | column_name | min_value | max_value |
|
+--------------+------------+-------------+-----------+-----------+
|
| test | t1 | a | NULL | NULL |
|
+--------------+------------+-------------+-----------+-----------+
|
1 row in set (0.029 sec)
|
As can be seen, the last 2 queries show the extent ranges are invalid. Correct output for the last 2 queries should be:
MariaDB [test]> select calshowpartitionsbyvalue('t1', 'a', 'aa', 'zz');
|
+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| calshowpartitionsbyvalue('t1', 'a', 'aa', 'zz') |
|
+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| Part# Min Max Status
|
0.0.1 abc xyz Enabled |
|
+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
1 row in set (0.001 sec)
|
|
MariaDB [test]> select c.table_schema, c.table_name, c.column_name, e.min_value, e.max_value from information_schema.columnstore_extents e, information_schema.columnstore_columns c where c.table_schema='test' and c.table_name='t1' and c.column_name='a' and c.object_id=e.object_id;
|
+--------------+------------+-------------+-----------+-----------+
|
| table_schema | table_name | column_name | min_value | max_value |
|
+--------------+------------+-------------+-----------+-----------+
|
| test | t1 | a | 6513249 | 8026488 |
|
+--------------+------------+-------------+-----------+-----------+
|
1 row in set (0.031 sec)
|
This is a performance regression since for queries with certain WHERE predicates, the extents should be eliminated but they will be incorrectly scanned as they are invalid.
|