morningman commented on code in PR #51913:
URL: https://github.com/apache/doris/pull/51913#discussion_r2189182541


##########
be/src/vec/exec/jni_connector.cpp:
##########
@@ -148,27 +148,36 @@ Status JniConnector::get_next_block(Block* block, size_t* 
read_rows, bool* eof)
 Status JniConnector::get_table_schema(std::string& table_schema_str) {
     JNIEnv* env = nullptr;
     RETURN_IF_ERROR(JniUtil::GetJNIEnv(&env));
-    // Call org.apache.doris.jni.JniScanner#getTableSchema
-    // return the TableSchema information
+
     jstring jstr = (jstring)env->CallObjectMethod(_jni_scanner_obj, 
_jni_scanner_get_table_schema);
     RETURN_ERROR_IF_EXC(env);
-    table_schema_str = env->GetStringUTFChars(jstr, nullptr);
+
+    const char* cstr = env->GetStringUTFChars(jstr, nullptr);
     RETURN_ERROR_IF_EXC(env);
+
+    if (cstr == nullptr) {
+        return Status::RuntimeError("GetStringUTFChars returned null");
+    }
+
+    table_schema_str = std::string(cstr); // copy to std::string
+    env->ReleaseStringUTFChars(jstr, cstr);
+    env->DeleteLocalRef(jstr);
     return Status::OK();
 }
 
-std::map<std::string, std::string> JniConnector::get_statistics(JNIEnv* env) {
+Status JniConnector::get_statistics(JNIEnv* env, std::map<std::string, 
std::string> result) {

Review Comment:
   ```suggestion
   Status JniConnector::get_statistics(JNIEnv* env, std::map<std::string, 
std::string>& result) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to