| 133 | } |
| 134 | |
| 135 | Status ExternalDataSourceExecutor::Init(const string& jar_path, |
| 136 | const string& class_name, const string& api_version, const string& init_string) { |
| 137 | DCHECK(!is_initialized_); |
| 138 | LibCacheEntryHandle handle; |
| 139 | string local_jar_path; |
| 140 | // TODO(IMPALA-6727): pass the mtime from the coordinator. for now, skip the mtime |
| 141 | // check (-1). |
| 142 | if (!jar_path.empty()) { |
| 143 | RETURN_IF_ERROR(LibCache::instance()->GetLocalPath( |
| 144 | jar_path, LibCache::TYPE_JAR, -1, &handle, &local_jar_path)); |
| 145 | } |
| 146 | JNIEnv* jni_env = JniUtil::GetJNIEnv(); |
| 147 | |
| 148 | // Add a scoped cleanup jni reference object. This cleans up local refs made below. |
| 149 | JniLocalFrame jni_frame; |
| 150 | RETURN_IF_ERROR(jni_frame.push(jni_env)); |
| 151 | |
| 152 | jstring jar_path_jstr = jni_env->NewStringUTF(local_jar_path.c_str()); |
| 153 | RETURN_ERROR_IF_EXC(jni_env); |
| 154 | jstring class_name_jstr = jni_env->NewStringUTF(class_name.c_str()); |
| 155 | RETURN_ERROR_IF_EXC(jni_env); |
| 156 | jstring api_version_jstr = jni_env->NewStringUTF(api_version.c_str()); |
| 157 | RETURN_ERROR_IF_EXC(jni_env); |
| 158 | jstring init_string_jstr = jni_env->NewStringUTF(init_string.c_str()); |
| 159 | RETURN_ERROR_IF_EXC(jni_env); |
| 160 | |
| 161 | const JniState& s = JniState::GetInstance(); |
| 162 | jobject local_exec = jni_env->NewObject(s.executor_class_, s.ctor_, jar_path_jstr, |
| 163 | class_name_jstr, api_version_jstr, init_string_jstr); |
| 164 | RETURN_ERROR_IF_EXC(jni_env); |
| 165 | RETURN_IF_ERROR(JniUtil::LocalToGlobalRef(jni_env, local_exec, &executor_)); |
| 166 | RETURN_IF_ERROR(s.UpdateClassCacheMetrics()); |
| 167 | is_initialized_ = true; |
| 168 | return Status::OK(); |
| 169 | } |
| 170 | |
| 171 | // JniUtil::CallJniMethod() does not compile when the template parameters are in |
| 172 | // another namespace. The issue seems to be that SerializeThriftMsg/DeserializeThriftMsg |
no test coverage detected