You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "zhangstar333 (via GitHub)" <gi...@apache.org> on 2023/07/04 09:00:44 UTC

[GitHub] [doris] zhangstar333 commented on a diff in pull request #21388: [refactor](udf) refactor java-udf execute method by using for loop

zhangstar333 commented on code in PR #21388:
URL: https://github.com/apache/doris/pull/21388#discussion_r1251725297


##########
be/src/vec/functions/function_java_udf.cpp:
##########
@@ -130,189 +141,177 @@ Status JavaFunctionCall::execute(FunctionContext* context, Block& block,
             context->get_function_state(FunctionContext::THREAD_LOCAL));
     JniEnv* jni_env =
             reinterpret_cast<JniEnv*>(context->get_function_state(FunctionContext::FRAGMENT_LOCAL));
-    int arg_idx = 0;
-    ColumnPtr data_cols[arguments.size()];
-    ColumnPtr null_cols[arguments.size()];
-    for (size_t col_idx : arguments) {
-        ColumnWithTypeAndName& column = block.get_by_position(col_idx);
+    int arg_size = arguments.size();
+    ColumnPtr data_cols[arg_size];
+    ColumnPtr null_cols[arg_size];
+    jclass obj_class = env->FindClass("[Ljava/lang/Object;");
+    jclass arraylist_class = env->FindClass("Ljava/util/ArrayList;");
+    jobjectArray arg_objects = env->NewObjectArray(arg_size, obj_class, nullptr);
+    int64_t nullmap_address = 0;
+    for (size_t arg_idx = 0; arg_idx < arg_size; ++arg_idx) {
+        bool arg_column_nullable = false;
+        // get argument column and type
+        ColumnWithTypeAndName& column = block.get_by_position(arguments[arg_idx]);
+        auto column_type = column.type;
         data_cols[arg_idx] = column.column->convert_to_full_column_if_const();
-        if (!_argument_types[arg_idx]->equals(*column.type)) {
+
+        // check type
+        if (_argument_types[arg_idx]->equals(*column_type) == false) {

Review Comment:
   use check maybe cause BE coredump, this could return Invalid Argument status



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org