Skip to content

Commit 8d02507

Browse files
committed
fix formate
1 parent 0f97a59 commit 8d02507

File tree

3 files changed

+36
-30
lines changed

3 files changed

+36
-30
lines changed

be/src/util/jni-util.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ Status Util::clean_udf_class_load_cache(const std::string& function_signature) {
339339
return Status::OK();
340340
}
341341

342-
Status Util::_init_collect_class() WARN_UNUSED_RESULT {
342+
Status Util::_init_collect_class() {
343343
JNIEnv* env = nullptr;
344344
RETURN_IF_ERROR(Jni::Env::Get(&env));
345345
// for hashmap
@@ -384,7 +384,7 @@ Status Util::Init() {
384384
return Status::OK();
385385
}
386386

387-
Status Util::_init_register_natives() WARN_UNUSED_RESULT {
387+
Status Util::_init_register_natives() {
388388
JNIEnv* env = nullptr;
389389
RETURN_IF_ERROR(Jni::Env::Get(&env));
390390
// Find JNINativeMethod class and create a global ref.
@@ -414,9 +414,8 @@ Status Util::_init_register_natives() WARN_UNUSED_RESULT {
414414
(void*)&JavaNativeMethods::memoryFreeBatch},
415415
};
416416

417-
int res =
418-
env->RegisterNatives(local_jni_native_exc_cl, java_native_methods,
419-
sizeof(java_native_methods) / sizeof(java_native_methods[0]));
417+
int res = env->RegisterNatives(local_jni_native_exc_cl, java_native_methods,
418+
sizeof(java_native_methods) / sizeof(java_native_methods[0]));
420419
DCHECK_EQ(res, 0);
421420
if (res) [[unlikely]] {
422421
return Status::JniError("Failed to RegisterNatives.");

be/src/util/jni-util.h

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ class Env {
6565
return Status::OK();
6666
}
6767

68-
static Status Init() WARN_UNUSED_RESULT { return init_throw_exception(); }
68+
static Status Init() { return init_throw_exception(); }
6969

7070
static Status GetJniExceptionMsg(JNIEnv* env, bool log_stack = true,
7171
const std::string& prefix = "") WARN_UNUSED_RESULT;
7272

7373
private:
7474
static Status GetJNIEnvSlowPath(JNIEnv** env);
75-
static Status init_throw_exception() WARN_UNUSED_RESULT {
75+
static Status init_throw_exception() {
7676
JNIEnv* env = nullptr;
7777
RETURN_IF_ERROR(Jni::Env::Get(&env));
7878

@@ -370,8 +370,8 @@ class FunctionCall {
370370
requires std::disjunction_v<std::is_same<T, jboolean>, std::is_same<T, jbyte>,
371371
std::is_same<T, jchar>, std::is_same<T, jshort>,
372372
std::is_same<T, jint>, std::is_same<T, jlong>,
373-
std::is_same<T, jfloat>, std::is_same<T, jdouble> >
374-
FunctionCall& with_arg(T arg) WARN_UNUSED_RESULT {
373+
std::is_same<T, jfloat>, std::is_same<T, jdouble>>
374+
FunctionCall& with_arg(T arg) {
375375
jvalue v;
376376
std::memset(&v, 0, sizeof(v));
377377
if constexpr (std::is_same_v<T, jboolean>) {
@@ -414,11 +414,12 @@ class FunctionCall {
414414

415415
Status call() {
416416
using return_type = typename CallHelper<tag>::RETURN_TYPE;
417-
if constexpr (std::disjunction_v<std::is_same<return_type, jboolean>, std::is_same<return_type, jbyte>,
418-
std::is_same<return_type, jchar>, std::is_same<return_type, jshort>,
419-
std::is_same<return_type, jint>, std::is_same<return_type, jlong>,
420-
std::is_same<return_type, jfloat>, std::is_same<return_type, jdouble>,
421-
std::is_same<return_type, void>>) {
417+
if constexpr (std::disjunction_v<
418+
std::is_same<return_type, jboolean>, std::is_same<return_type, jbyte>,
419+
std::is_same<return_type, jchar>, std::is_same<return_type, jshort>,
420+
std::is_same<return_type, jint>, std::is_same<return_type, jlong>,
421+
std::is_same<return_type, jfloat>, std::is_same<return_type, jdouble>,
422+
std::is_same<return_type, void>>) {
422423
CallHelper<tag>::call_impl(_env, _base, _method, _args.data());
423424
RETURN_ERROR_IF_EXC(_env);
424425
} else if constexpr (std::is_same_v<return_type, jobject>) {
@@ -459,8 +460,8 @@ class NonvirtaulFunctionCall : public FunctionCall<tag> {
459460
requires std::disjunction_v<std::is_same<T, jboolean>, std::is_same<T, jbyte>,
460461
std::is_same<T, jchar>, std::is_same<T, jshort>,
461462
std::is_same<T, jint>, std::is_same<T, jlong>,
462-
std::is_same<T, jfloat>, std::is_same<T, jdouble> >
463-
NonvirtaulFunctionCall& with_arg(T arg) WARN_UNUSED_RESULT {
463+
std::is_same<T, jfloat>, std::is_same<T, jdouble>>
464+
NonvirtaulFunctionCall& with_arg(T arg) {
464465
jvalue v;
465466
std::memset(&v, 0, sizeof(v));
466467
if constexpr (std::is_same_v<T, jboolean>) {
@@ -492,17 +493,18 @@ class NonvirtaulFunctionCall : public FunctionCall<tag> {
492493
// no override
493494
Status call() {
494495
using return_type = typename CallHelper<tag>::RETURN_TYPE;
495-
if constexpr (std::disjunction_v<std::is_same<return_type, jboolean>, std::is_same<return_type, jbyte>,
496-
std::is_same<return_type, jchar>, std::is_same<return_type, jshort>,
497-
std::is_same<return_type, jint>, std::is_same<return_type, jlong>,
498-
std::is_same<return_type, jfloat>, std::is_same<return_type, jdouble>,
499-
std::is_same<return_type, void>>) {
496+
if constexpr (std::disjunction_v<
497+
std::is_same<return_type, jboolean>, std::is_same<return_type, jbyte>,
498+
std::is_same<return_type, jchar>, std::is_same<return_type, jshort>,
499+
std::is_same<return_type, jint>, std::is_same<return_type, jlong>,
500+
std::is_same<return_type, jfloat>, std::is_same<return_type, jdouble>,
501+
std::is_same<return_type, void>>) {
500502
CallHelper<tag>::call_impl(this->_env, this->_base, _cls, this->_method,
501503
this->_args.data());
502504
RETURN_ERROR_IF_EXC(this->_env);
503505
} else if constexpr (std::is_same_v<return_type, jobject>) {
504506
jobject tmp = CallHelper<tag>::call_impl(this->_env, this->_base, _cls, this->_method,
505-
this->_args.data());
507+
this->_args.data());
506508
RETURN_ERROR_IF_EXC(this->_env);
507509
this->_env->DeleteLocalRef(tmp);
508510
} else {
@@ -738,6 +740,7 @@ class String : public Object<Ref> {
738740
Status get_string_chars(JNIEnv* env, StringBufferGuard<Ref>* jni_chars) const {
739741
return StringBufferGuard<Ref>::create(env, *this, jni_chars, nullptr);
740742
}
743+
741744
private:
742745
DISALLOW_COPY_AND_ASSIGN(String);
743746
};
@@ -810,6 +813,7 @@ class Array : public Object<Ref> {
810813
RETURN_IF_ERROR(WriteBufferToByteArray(env, (jbyte*)buffer, size, serialized_msg));
811814
return Status::OK();
812815
}
816+
813817
private:
814818
DISALLOW_COPY_AND_ASSIGN(Array);
815819
};
@@ -907,6 +911,7 @@ class Class : public Object<Ref> {
907911
DCHECK(!method_id.uninitialized());
908912
return FunctionCall<StaticVoidMethod>::instance(env, (jclass)this->_obj, method_id._id);
909913
}
914+
910915
private:
911916
DISALLOW_COPY_AND_ASSIGN(Class);
912917
};
@@ -922,7 +927,7 @@ using GlobalString = String<Global>;
922927

923928
template <CallTag tag>
924929
template <RefType Ref>
925-
FunctionCall<tag>& FunctionCall<tag>::with_arg(const Object<Ref>& obj) WARN_UNUSED_RESULT {
930+
FunctionCall<tag>& FunctionCall<tag>::with_arg(const Object<Ref>& obj) {
926931
jvalue v;
927932
std::memset(&v, 0, sizeof(v));
928933
v.l = obj._obj;
@@ -932,8 +937,7 @@ FunctionCall<tag>& FunctionCall<tag>::with_arg(const Object<Ref>& obj) WARN_UNUS
932937

933938
template <CallTag tag>
934939
template <RefType Ref>
935-
NonvirtaulFunctionCall<tag>& NonvirtaulFunctionCall<tag>::with_arg(const Object<Ref>& obj)
936-
WARN_UNUSED_RESULT {
940+
NonvirtaulFunctionCall<tag>& NonvirtaulFunctionCall<tag>::with_arg(const Object<Ref>& obj) {
937941
jvalue v;
938942
std::memset(&v, 0, sizeof(v));
939943
v.l = obj._obj;

be/src/vec/exec/jni_connector.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Status JniConnector::get_table_schema(std::string& table_schema_str) {
158158
_jni_scanner_obj.call_object_method(env, _jni_scanner_get_table_schema).call(&jstr));
159159
Jni::LocalStringBufferGuard cstr;
160160
RETURN_IF_ERROR(jstr.get_string_chars(env, &cstr));
161-
table_schema_str = std::string{cstr.get()}; // copy to std::string
161+
table_schema_str = std::string {cstr.get()}; // copy to std::string
162162
return Status::OK();
163163
}
164164

@@ -182,14 +182,16 @@ Status JniConnector::close() {
182182

183183
RETURN_ERROR_IF_EXC(env);
184184
int64_t _append = 0;
185-
RETURN_IF_ERROR(_jni_scanner_obj.call_long_method(env, _jni_scanner_get_append_data_time)
186-
.call(&_append));
185+
RETURN_IF_ERROR(
186+
_jni_scanner_obj.call_long_method(env, _jni_scanner_get_append_data_time)
187+
.call(&_append));
187188

188189
COUNTER_UPDATE(_java_append_data_time, _append);
189190

190191
int64_t _create = 0;
191192
RETURN_IF_ERROR(
192-
_jni_scanner_obj.call_long_method(env, _jni_scanner_get_create_vector_table_time)
193+
_jni_scanner_obj
194+
.call_long_method(env, _jni_scanner_get_create_vector_table_time)
193195
.call(&_create));
194196

195197
COUNTER_UPDATE(_java_create_vector_table_time, _create);
@@ -202,7 +204,8 @@ Status JniConnector::close() {
202204

203205
// _fill_block may be failed and returned, we should release table in close.
204206
// org.apache.doris.common.jni.JniScanner#releaseTable is idempotent
205-
RETURN_IF_ERROR(_jni_scanner_obj.call_void_method(env, _jni_scanner_release_table).call());
207+
RETURN_IF_ERROR(
208+
_jni_scanner_obj.call_void_method(env, _jni_scanner_release_table).call());
206209
RETURN_IF_ERROR(_jni_scanner_obj.call_void_method(env, _jni_scanner_close).call());
207210
}
208211
}

0 commit comments

Comments
 (0)