Details
- 
    
Bug
 - 
    Status: Closed (View Workflow)
 - 
    
Critical
 - 
    Resolution: Duplicate
 - 
    1.1.5
 - 
    None
 - 
    None
 - 
    Linux CentOS 7.5
 
Description
When creating a table with DECIMAL columns and a specific precision, then using mcsapi to insert NULL will end up with incorrect data. Create to following table:
					CREATE TABLE `t1` (  | 
		
					`c1` decimal(10,0) DEFAULT NULL,  | 
		
					`c2` decimal(9,0) DEFAULT NULL,  | 
		
					`c3` decimal(16,0) DEFAULT NULL  | 
		
					) ENGINE=Columnstore
			 | 
		
Compile and run this program, which should insert INTO into all columns in the table above:
					#include <libmcsapi/mcsapi.h>
			 | 
		
					#include <iostream>
			 | 
		
| 
					 | 
		
					int main(int argc, char *argv[])
			 | 
		
					   {
			 | 
		
					   mcsapi::ColumnStoreDriver* driver = nullptr;
			 | 
		
					   mcsapi::ColumnStoreBulkInsert* bulk = nullptr;
			 | 
		
| 
					 | 
		
					   try {
			 | 
		
					      driver = new mcsapi::ColumnStoreDriver();
			 | 
		
					      bulk = driver->createBulkInsert("test", "t1", 0, 0);
			 | 
		
					      bulk->setNull(0);
			 | 
		
					      bulk->setNull(1);
			 | 
		
					      bulk->setNull(2);
			 | 
		
					      bulk->writeRow();
			 | 
		
					      bulk->commit();
			 | 
		
					   } catch (mcsapi::ColumnStoreError &e) {
			 | 
		
					      std::cout << "Error caught: " << e.what() << std::endl;
			 | 
		
					   }
			 | 
		
					   delete bulk;
			 | 
		
					   delete driver;
			 | 
		
| 
					 | 
		
					   return 0;
			 | 
		
					   }
			 | 
		
					MariaDB [test]> select * from t1;  | 
		
					+------+------+---------+  | 
		
					| c1   | c2   | c3      |
			 | 
		
					+------+------+---------+  | 
		
					| NULL | 0 | 8388608 |  | 
		
					+------+------+---------+  | 
		
					1 row in set (0.11 sec)  | 
		
Attachments
Issue Links
- duplicates
 - 
                    
MCOL-1322 data corruption when setting NUMERIC columns to NULL through the python and C++ API
-         
 - Closed
 
 -