[MCOL-4579] CHAR(2) NULL: empty strings or SPACE(N) get converted to NULL Created: 2021-03-04  Updated: 2023-07-25  Resolved: 2023-04-25

Status: Closed
Project: MariaDB ColumnStore
Component/s: PrimProc
Affects Version/s: 5.5.1
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Sergey Zefirov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MCOL-4403 Trailing spaces not behaving as InnoDB Closed
Duplicate
duplicates MCOL-271 Improved support for NULL for Varchar... Closed
Problem/Incident
is caused by MCOL-3574 EMPTY column for persistant storage Closed
Epic Link: ColumnStore Compatibility Improvements
Sprint: 2021-5, 2021-6

 Description   

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a CHAR(2) DEFAULT '') ENGINE=ColumnStore;
INSERT INTO t1 VALUES ('');
INSERT INTO t1 VALUES (' ');
INSERT INTO t1 VALUES ('  ');
SELECT HEX(a) FROM t1;

+--------+
| HEX(a) |
+--------+
| NULL   |
| NULL   |
| NULL   |
+--------+

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a CHAR(2) DEFAULT 'aa') ENGINE=ColumnStore;
INSERT INTO t1 VALUES ('');
INSERT INTO t1 VALUES (' ');
INSERT INTO t1 VALUES ('  ');
SELECT HEX(a) FROM t1;

+--------+
| HEX(a) |
+--------+
| NULL   |
| NULL   |
| NULL   |
+--------+

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a CHAR(2) DEFAULT ' ') ENGINE=ColumnStore;
INSERT INTO t1 VALUES ('');
INSERT INTO t1 VALUES (' ');
INSERT INTO t1 VALUES ('  ');
SELECT HEX(a) FROM t1;

+--------+
| HEX(a) |
+--------+
| NULL   |
| NULL   |
| NULL   |
+--------+

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a CHAR(2) DEFAULT '  ') ENGINE=ColumnStore;
INSERT INTO t1 VALUES ('');
INSERT INTO t1 VALUES (' ');
INSERT INTO t1 VALUES ('  ');
SELECT HEX(a) FROM t1;

+--------+
| HEX(a) |
+--------+
| NULL   |
| NULL   |
| NULL   |
+--------+

In all above cases, empty strings as well as strings consisting only of space characters were replaced to NULL. Looks wrong.

Also, inserting an empty string should:

  • either store NULL for now (like it does)
  • or store the true empty string (when we fix the flaw that an empty string is NULL)


 Comments   
Comment by Daniel Lee (Inactive) [ 2023-04-25 ]

Build verified:
engine: 1e56a0b557efb677d07533d05eb02ad723955317
server: 11c83d9ae9eb249d00589cc6ab71e7f4e67ffa27
buildNo: 7534
This scenario has been fixed as part of MCOL-271. ColumnStore and InnoDB results matched.

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