@@ -166,8 +166,14 @@ class EXPORT_DECL DBConnectionImpl {
166166 void setShowOutput (bool flag) {
167167 msg_ = flag;
168168 }
169- py::object runPy (const string& script, int priority = 4 , int parallelism = 2 , int fetchSize = 0 , bool clearMemory = false , bool pickleTableToList=false );
170- py::object runPy (const string& funcName, vector<ConstantSP>& args, int priority = 4 , int parallelism = 2 , int fetchSize = 0 , bool clearMemory = false , bool pickleTableToList=false );
169+ py::object runPy (
170+ const string& script, int priority = 4 , int parallelism = 2 ,
171+ int fetchSize = 0 , bool clearMemory = false ,
172+ bool pickleTableToList = false , bool disableDecimal = false );
173+ py::object runPy (
174+ const string& funcName, vector<ConstantSP>& args, int priority = 4 , int parallelism = 2 ,
175+ int fetchSize = 0 , bool clearMemory = false ,
176+ bool pickleTableToList = false , bool disableDecimal = false );
171177 void setkeepAliveTime (int keepAliveTime){
172178 keepAliveTime_ = keepAliveTime;
173179 }
@@ -176,9 +182,12 @@ class EXPORT_DECL DBConnectionImpl {
176182 }
177183 DataInputStreamSP getDataInputStream (){return inputStream_;}
178184private:
179- long generateRequestFlag (bool clearSessionMemory = false , bool disableprotocol = false , bool pickleTableToList = false );
185+ long generateRequestFlag (bool clearSessionMemory = false , bool disableprotocol = false , bool pickleTableToList = false , bool disableDecimal = false );
180186 ConstantSP run (const string& script, const string& scriptType, vector<ConstantSP>& args, int priority = 4 , int parallelism = 2 ,int fetchSize = 0 , bool clearMemory = false );
181- py::object runPy (const string& script, const string& scriptType, vector<ConstantSP>& args, int priority = 4 , int parallelism = 2 ,int fetchSize = 0 , bool clearMemory = false , bool pickleTableToList=false );
187+ py::object runPy (
188+ const string& script, const string& scriptType, vector<ConstantSP>& args,
189+ int priority = 4 , int parallelism = 2 , int fetchSize = 0 , bool clearMemory = false ,
190+ bool pickleTableToList = false , bool disableDecimal = false );
182191 bool connect ();
183192 void login ();
184193
@@ -229,13 +238,13 @@ class HIDEVISIBILITY DBConnectionPoolImpl{
229238public:
230239 struct Task {
231240 Task (const string& sc = " " , int id = 0 , int pr = 4 , int pa = 2 , bool clearM = false ,
232- bool isPy = false , bool pickleTableToL= false )
233- : script(sc), identity(id), priority(pr), parallelism(pa), clearMemory(clearM), isPyTask(isPy )
234- , pickleTableToList(pickleTableToL){}
241+ bool isPy = false , bool pickleTableToL = false , bool disableDec = false )
242+ : script(sc), identity(id), priority(pr), parallelism(pa), clearMemory(clearM)
243+ , isPyTask(isPy), pickleTableToList(pickleTableToL), disableDecimal(disableDec ){}
235244 Task (const string& function, const vector<ConstantSP>& args, int id = 0 , int pr = 4 , int pa = 2 , bool clearM = false ,
236- bool isPy = false ,bool pickleTableToL= false )
245+ bool isPy = false , bool pickleTableToL = false , bool disableDec = false )
237246 : script(function), arguments(args), identity(id), priority(pr), parallelism(pa), clearMemory(clearM)
238- , isPyTask(isPy),pickleTableToList(pickleTableToL){ isFunc = true ; }
247+ , isPyTask(isPy), pickleTableToList(pickleTableToL), disableDecimal(disableDec ){ isFunc = true ; }
239248 string script;
240249 vector<ConstantSP> arguments;
241250 int identity;
@@ -244,7 +253,8 @@ class HIDEVISIBILITY DBConnectionPoolImpl{
244253 bool clearMemory;
245254 bool isFunc = false ;
246255 bool isPyTask = true ;
247- bool pickleTableToList=false ;
256+ bool pickleTableToList = false ;
257+ bool disableDecimal = false ;
248258 };
249259
250260 DBConnectionPoolImpl (const string& hostName, int port, int threadNum = 10 , const string& userId = " " , const string& password = " " ,
@@ -292,13 +302,29 @@ class HIDEVISIBILITY DBConnectionPoolImpl{
292302 return workers_.size ();
293303 }
294304
295- void runPy (const string& script, int identity, int priority=4 , int parallelism=2 , int fetchSize=0 , bool clearMemory = false , bool pickleTableToList=false ){
296- queue_->push (Task (script, identity, priority, parallelism, clearMemory, true ,pickleTableToList));
305+ void runPy (
306+ const string& script, int identity,
307+ int priority = 4 , int parallelism = 2 ,
308+ int fetchSize = 0 , bool clearMemory = false ,
309+ bool pickleTableToList = false , bool disableDecimal = false
310+ ){
311+ queue_->push (Task (
312+ script, identity, priority, parallelism,
313+ clearMemory, true , pickleTableToList, disableDecimal
314+ ));
297315 taskStatus_.setResult (identity, TaskStatusMgmt::Result ());
298316 }
299317
300- void runPy (const string& functionName, const vector<ConstantSP>& args, int identity, int priority=4 , int parallelism=2 , int fetchSize=0 , bool clearMemory = false , bool pickleTableToList=false ){
301- queue_->push (Task (functionName, args, identity, priority, parallelism, clearMemory, true ,pickleTableToList));
318+ void runPy (
319+ const string& functionName, const vector<ConstantSP>& args, int identity,
320+ int priority = 4 , int parallelism = 2 ,
321+ int fetchSize = 0 , bool clearMemory = false ,
322+ bool pickleTableToList = false , bool disableDecimal = false
323+ ){
324+ queue_->push (Task (
325+ functionName, args, identity, priority, parallelism,
326+ clearMemory, true , pickleTableToList, disableDecimal
327+ ));
302328 taskStatus_.setResult (identity, TaskStatusMgmt::Result ());
303329 }
304330
@@ -1022,14 +1048,27 @@ ConstantSP DBConnectionImpl::run(const string& funcName, vector<ConstantSP>& arg
10221048 return run (funcName, " function" , args, priority, parallelism, fetchSize, clearMemory);
10231049}
10241050
1025- py::object DBConnectionImpl::runPy (const string &script, int priority, int parallelism, int fetchSize, bool clearMemory, bool pickleTableToList) {
1051+ py::object DBConnectionImpl::runPy (
1052+ const string &script, int priority,
1053+ int parallelism, int fetchSize, bool clearMemory,
1054+ bool pickleTableToList, bool disableDecimal
1055+ ) {
10261056 vector<ConstantSP> args;
1027- return runPy (script, " script" , args, priority, parallelism, fetchSize, clearMemory,pickleTableToList);
1057+ return runPy (
1058+ script, " script" , args, priority, parallelism,
1059+ fetchSize, clearMemory, pickleTableToList, disableDecimal
1060+ );
10281061}
10291062
1030- py::object DBConnectionImpl::runPy (const string &funcName, vector<ConstantSP> &args, int priority, int parallelism,
1031- int fetchSize, bool clearMemory, bool pickleTableToList) {
1032- return runPy (funcName, " function" , args, priority, parallelism, fetchSize, clearMemory,pickleTableToList);
1063+ py::object DBConnectionImpl::runPy (
1064+ const string &funcName, vector<ConstantSP> &args, int priority,
1065+ int parallelism, int fetchSize, bool clearMemory,
1066+ bool pickleTableToList, bool disableDecimal
1067+ ) {
1068+ return runPy (
1069+ funcName, " function" , args, priority, parallelism,
1070+ fetchSize, clearMemory, pickleTableToList, disableDecimal
1071+ );
10331072}
10341073
10351074ConstantSP DBConnectionImpl::upload (const string& name, const ConstantSP& obj) {
@@ -1056,13 +1095,13 @@ ConstantSP DBConnectionImpl::upload(vector<string>& names, vector<ConstantSP>& o
10561095 return run (varNames, " variable" , objs);
10571096}
10581097
1059- long DBConnectionImpl::generateRequestFlag (bool clearSessionMemory, bool disableprotocol, bool pickleTableToList) {
1098+ long DBConnectionImpl::generateRequestFlag (bool clearSessionMemory, bool disableprotocol, bool pickleTableToList, bool disableDecimal ) {
10601099 long flag = 32 ; // 32 API client
1061- if (asynTask_){
1100+ if (asynTask_) {
10621101 DLOG (" async" );
10631102 flag += 4 ;
10641103 }
1065- if (clearSessionMemory){
1104+ if (clearSessionMemory) {
10661105 DLOG (" clearMem" );
10671106 flag += 16 ;
10681107 }
@@ -1084,12 +1123,15 @@ long DBConnectionImpl::generateRequestFlag(bool clearSessionMemory, bool disable
10841123 else {
10851124 throw RuntimeException (" unsupport PROTOCOL Type: " + std::to_string (protocol_));
10861125 }
1087- if (python_){
1126+ if (python_) {
10881127 DLOG (" python" );
10891128 flag += 2048 ;
10901129 }
1091- if (isReverseStreaming_){
1130+ if (isReverseStreaming_) {
10921131 flag += 131072 ;
1132+ }
1133+ if (disableDecimal) {
1134+ flag += (1 << 23 );
10931135 }
10941136 return flag;
10951137}
@@ -1244,9 +1286,11 @@ DBConnection::DBConnection(bool enableSSL, bool asynTask, int keepAliveTime, boo
12441286 lastConnNodeIndex_ (0 ), reconnect_(false ), closed_(true ), msg_(true ){
12451287}
12461288
1247- py::object DBConnectionImpl::runPy (const string &script, const string &scriptType, vector<ConstantSP> &args,
1248- int priority, int parallelism, int fetchSize, bool clearMemory,
1249- bool pickleTableToList) {
1289+ py::object DBConnectionImpl::runPy (
1290+ const string &script, const string &scriptType, vector<ConstantSP> &args,
1291+ int priority, int parallelism, int fetchSize, bool clearMemory,
1292+ bool pickleTableToList, bool disableDecimal
1293+ ) {
12501294 // RecordTime record("Db.runPy"+script);
12511295 DLOG (" runPy" ,script," start argsize" ,args.size ());
12521296 // force Python release GIL
@@ -1267,8 +1311,10 @@ py::object DBConnectionImpl::runPy(const string &script, const string &scriptTyp
12671311 }
12681312 string out (" API2 " + sessionId_ + " " );
12691313 out.append (Util::convert ((int )body.size ()));
1270- long flag=generateRequestFlag (clearMemory,false ,pickleTableToList);
1271- DLOG (" runPy flag" ,flag," protocol_" ,protocol_," pickleTableToList " , pickleTableToList," compress" ,compress_," python" ,python_);
1314+ long flag = generateRequestFlag (clearMemory, false , pickleTableToList, disableDecimal);
1315+ DLOG (" runPy flag: " , flag);
1316+ DLOG (" protocol: " , protocol_, " pickleTableToList: " , pickleTableToList);
1317+ DLOG (" compress: " , compress_, " python: " , python_, " disableDecimal: " , disableDecimal);
12721318 out.append (" / " + std::to_string (flag) + " _1_" + std::to_string (priority) + " _" + std::to_string (parallelism));
12731319 if (fetchSize > 0 )
12741320 out.append (" __" + std::to_string (fetchSize));
@@ -1726,11 +1772,14 @@ ConstantSP DBConnection::run(const string& script, int priority, int parallelism
17261772 return NULL ;
17271773}
17281774
1729- py::object DBConnection::runPy (const string &script, int priority, int parallelism, int fetchSize, bool clearMemory, bool pickleTableToList) {
1775+ py::object DBConnection::runPy (
1776+ const string &script, int priority, int parallelism,
1777+ int fetchSize, bool clearMemory, bool pickleTableToList, bool disableDecimal
1778+ ) {
17301779 if (nodes_.empty () == false ) {
17311780 while (closed_ == false ) {
17321781 try {
1733- return conn_->runPy (script, priority, parallelism, fetchSize, clearMemory, pickleTableToList);
1782+ return conn_->runPy (script, priority, parallelism, fetchSize, clearMemory, pickleTableToList, disableDecimal );
17341783 } catch (IOException& e) {
17351784 string host;
17361785 int port = 0 ;
@@ -1749,7 +1798,7 @@ py::object DBConnection::runPy(const string &script, int priority, int paralleli
17491798 }
17501799 return py::none ();
17511800 } else {
1752- return conn_->runPy (script, priority, parallelism, fetchSize, clearMemory, pickleTableToList);
1801+ return conn_->runPy (script, priority, parallelism, fetchSize, clearMemory, pickleTableToList, disableDecimal );
17531802 }
17541803}
17551804
@@ -1781,12 +1830,14 @@ ConstantSP DBConnection::run(const string& funcName, vector<dolphindb::ConstantS
17811830 return NULL ;
17821831}
17831832
1784- py::object DBConnection::runPy (const string &funcName, vector<ConstantSP> &args, int priority, int parallelism,
1785- int fetchSize, bool clearMemory, bool pickleTableToList) {
1833+ py::object DBConnection::runPy (
1834+ const string &funcName, vector<ConstantSP> &args, int priority, int parallelism,
1835+ int fetchSize, bool clearMemory, bool pickleTableToList, bool disableDecimal
1836+ ) {
17861837 if (nodes_.empty () == false ) {
17871838 while (closed_ == false ) {
17881839 try {
1789- return conn_->runPy (funcName, args, priority, parallelism, fetchSize, clearMemory,pickleTableToList);
1840+ return conn_->runPy (funcName, args, priority, parallelism, fetchSize, clearMemory, pickleTableToList, disableDecimal );
17901841 } catch (IOException& e) {
17911842 string host;
17921843 int port = 0 ;
@@ -1804,7 +1855,7 @@ py::object DBConnection::runPy(const string &funcName, vector<ConstantSP> &args,
18041855 }
18051856 return py::none ();
18061857 } else {
1807- return conn_->runPy (funcName, args, priority, parallelism, fetchSize, clearMemory,pickleTableToList);
1858+ return conn_->runPy (funcName, args, priority, parallelism, fetchSize, clearMemory, pickleTableToList, disableDecimal );
18081859 }
18091860}
18101861
@@ -2032,10 +2083,10 @@ void AsynWorker::run() {
20322083 try {
20332084 if (task.isPyTask ){
20342085 if (task.isFunc ){
2035- pyResult = conn_->runPy (task.script , task.arguments , task.priority , task.parallelism , 0 , task.clearMemory ,task.pickleTableToList );
2086+ pyResult = conn_->runPy (task.script , task.arguments , task.priority , task.parallelism , 0 , task.clearMemory , task.pickleTableToList , task. disableDecimal );
20362087 }
20372088 else {
2038- pyResult = conn_->runPy (task.script , task.priority , task.parallelism , 0 , task.clearMemory ,task.pickleTableToList );
2089+ pyResult = conn_->runPy (task.script , task.priority , task.parallelism , 0 , task.clearMemory ,task.pickleTableToList , task. disableDecimal );
20392090 }
20402091 }
20412092 else {
@@ -2128,16 +2179,16 @@ void DBConnectionPool::run(const string& functionName, const vector<ConstantSP>&
21282179 pool_->run (functionName, args, identity, priority, parallelism, fetchSize, clearMemory);
21292180}
21302181
2131- void DBConnectionPool::runPy (const string& script, int identity, int priority, int parallelism, int fetchSize, bool clearMemory, bool pickleTableToList){
2182+ void DBConnectionPool::runPy (const string& script, int identity, int priority, int parallelism, int fetchSize, bool clearMemory, bool pickleTableToList, bool disableDecimal ){
21322183 if (identity < 0 )
21332184 throw RuntimeException (" Invalid identity: " + std::to_string (identity) + " . Identity must be a non-negative integer." );
2134- pool_->runPy (script, identity, priority, parallelism, fetchSize, clearMemory,pickleTableToList);
2185+ pool_->runPy (script, identity, priority, parallelism, fetchSize, clearMemory, pickleTableToList, disableDecimal );
21352186}
21362187
2137- void DBConnectionPool::runPy (const string& functionName, const vector<ConstantSP>& args, int identity, int priority, int parallelism, int fetchSize, bool clearMemory, bool pickleTableToList){
2188+ void DBConnectionPool::runPy (const string& functionName, const vector<ConstantSP>& args, int identity, int priority, int parallelism, int fetchSize, bool clearMemory, bool pickleTableToList, bool disableDecimal ){
21382189 if (identity < 0 )
21392190 throw RuntimeException (" Invalid identity: " + std::to_string (identity) + " . Identity must be a non-negative integer." );
2140- pool_->runPy (functionName, args, identity, priority, parallelism, fetchSize, clearMemory,pickleTableToList);
2191+ pool_->runPy (functionName, args, identity, priority, parallelism, fetchSize, clearMemory, pickleTableToList, disableDecimal );
21412192}
21422193
21432194bool DBConnectionPool::isFinished (int identity){
0 commit comments