Details
- 
    
Bug
 - 
    Status: Closed (View Workflow)
 - 
    
Major
 - 
    Resolution: Fixed
 - 
    1.1.3
 - 
    None
 - 
    None
 
- 
        2018-18
 
Description
Using the bulkInsert.setNull() function on a NUMERIC column results in data corruption. The columns and the ones that follow are affected.
A test case that reproduces this:
The table
					CREATE TABLE `test_null_decimal3` (  | 
		
					`id` varchar(128) NOT NULL,  | 
		
					`num1` decimal(8,6) DEFAULT NULL,  | 
		
					`num2` decimal(9,6) DEFAULT NULL,  | 
		
					`b` tinyint(1) DEFAULT NULL  | 
		
					) ENGINE=Columnstore DEFAULT CHARSET=utf8;  | 
		
Python code usage
					import pymcsapi  | 
		
					driver = pymcsapi.ColumnStoreDriver(columnstore_config_path)  | 
		
					bulk_insert = driver.createBulkInsert(db, table, 0, 0)  | 
		
| 
					 | 
		
					# INSERT INTO table VALUES ('text', NULL, NULL, 4)
			 | 
		
					bulk_insert.setColumn(0, 'text')  | 
		
					bulk_insert.setNull(1)  | 
		
					bulk_insert.setNull(2)  | 
		
					bulk_insert.setColumn(3, 4)  | 
		
| 
					 | 
		
					bulk_insert.writeRow()
			 | 
		
					bulk_insert.commit()
			 | 
		
The commit finishes successfully with no error counts. Querying the table gives this result:
					MariaDB [db]> select * from test_null_decimal3;
			 | 
		
					+------+----------+----------+------+
			 | 
		
					| id   | num1     | num2     | b    |
			 | 
		
					+------+----------+----------+------+
			 | 
		
					| text | 0.000000 | 8.388608 |    0 |
			 | 
		
					+------+----------+----------+------+
			 | 
		
					1 row in set (0.10 sec)
			 | 
		
You can see the values for num2 and b are wrong. I've had corruption errors on the table after this:
					2018-04-04 17:27:02 (27472) ERR  : writeToFile: error initializing to-be-compressed buffer for OID 5625;  Error in uncompressing data.  [1652]
			 | 
		
					2018-04-04 17:27:02 (27472) ERR  : writeToFileExtentCheck: write token extent failed:  Error in uncompressing data.  [1652]
			 | 
		
					2018-04-04 17:27:02 (27472) ERR  : finishParsing: flush error with column ;  Error in uncompressing data.  [1652]
			 | 
		
					2018-04-04 17:27:02 (27472) ERR  : setParseComplete completion error; Failed to load table: t;  Error in uncompressing data.  [1652]
			 | 
		
Doing the same insert through INSERT or cpimport gives the correct results. I'm running the 1.1.3 release
Attachments
Issue Links
- is duplicated by
 - 
                    
MCOL-1570 Wrong data when inserting NULL into DECIMAL column with non-default precision
-         
 - Closed
 
 -