[MCOL-4779] Invalid extent ranges for short character columns Created: 2021-06-28  Updated: 2021-07-13  Resolved: 2021-07-13

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: 6.1.1
Fix Version/s: 6.1.1

Type: Bug Priority: Blocker
Reporter: Gagan Goel (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: regression

Issue Links:
Problem/Incident
is caused by MCOL-2044 Update CPRange max/min for extent doi... Closed
Sprint: 2021-9

 Description   

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.



 Comments   
Comment by Daniel Lee (Inactive) [ 2021-07-13 ]

Build verified: 6.1.1 (#2873)

Verified test case in database mytest.

MariaDB [mytest]> create table t1 (a char(5))engine=columnstore;
Query OK, 0 rows affected (0.693 sec)
 
MariaDB [mytest]> insert into t1 values ('abc'), ('xyz');
Query OK, 2 rows affected (0.502 sec)
Records: 2  Duplicates: 0  Warnings: 0
 
MariaDB [mytest]> select * from t1;
+------+
| a    |
+------+
| abc  |
| xyz  |
+------+
2 rows in set (0.064 sec)
 
MariaDB [mytest]> 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.000 sec)
 
 
MariaDB [mytest]> 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='mytest' 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 |
+--------------+------------+-------------+-----------+-----------+
| mytest       | t1         | a           |   6513249 |   8026488 |
+--------------+------------+-------------+-----------+-----------+
1 row in set (0.012 sec)

Generated at Thu Feb 08 02:52:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.