[MCOL-1321] bulk write sdk python bindings does not support status out param in setColumn Created: 2018-04-04  Updated: 2023-10-26  Resolved: 2018-05-15

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

Type: Bug Priority: Major
Reporter: David Thompson (Inactive) Assignee: David Thompson (Inactive)
Resolution: Fixed Votes: 0
Labels: relnote

Sprint: 2018-08, 2018-09, 2018-10

 Description   

the setColumn method has an optional 3rd status parameter that is an output parameter. With the current python swig binding you can't access it. See this section for details to override the mapping to allow adding it to the return value:
http://www.swig.org/Doc3.0/Python.html#Python_nn46

This allows you to retrieve if the specified value was invalid and mapped to 0.
https://github.com/mariadb-corporation/mariadb-columnstore-api/blob/master/test/summary.cpp has some good test examples in c++ that should be replicated.

Also worth checking the rest of the api for output arguments as well.



 Comments   
Comment by Jens Röwekamp (Inactive) [ 2018-04-06 ]

This update will break the API usage, as ColumnStoreBulkInsert.setColumn's() output datatype will change from ColumnStoreBulkInsert to a tuple of (ColumnStoreBulkInsert, status).

Therefore, statements like

import pymcsapi
d = pymcsapi.ColumnStoreDriver()
b = d.createBulkInsert("schema","table",0,0)
 
#old syntax
b.setColumn(0,1).setColumn(1,34).setNull(3).writeRow() need to be rewritten to:
 
#new syntax
b.setColumn(0,1)[0].setColumn(1,34)[0].setNull(3)[0].writeRow()

need to be rewritten.

Comment by Jens Röwekamp (Inactive) [ 2018-04-07 ]

Added the API calls for Java to get additional status information when invoking setColumn().

Example invocation:

ColumnStoreDriver d = new ColumnStoreDriver();
ColumnStoreBulkInsert b = d.createBulkInsert(DB_NAME, TABLE_NAME, (short)0, 0);
columnstore_data_convert_status_t status;
int[] s = {-1}; // an int array needs to be passed to hold the status information
try {
    b.setColumn(0, Long.MAX_VALUE, s);
    status = columnstore_data_convert_status_t.values()[s[0]]; //we can convert the integer manually back to an enum value
    System.out.println(status);
    b.setColumn(1, "ABC", s);
    status = columnstore_data_convert_status_t.values()[s[0]];
    System.out.println(status);
    b.writeRow();
    b.commit();
} catch (Exception e) {
    b.rollback();
}

Comment by David Thompson (Inactive) [ 2018-05-15 ]

Verified regression tests and manual test.

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