You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/11/23 14:06:09 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #7157: [enhancement] Optimize get_json_xx function

morningman commented on a change in pull request #7157:
URL: https://github.com/apache/incubator-doris/pull/7157#discussion_r755154962



##########
File path: be/src/exprs/json_functions.cpp
##########
@@ -412,41 +419,47 @@ rapidjson::Value* JsonFunctions::get_json_object_from_parsed_json(
     return root;
 }
 
-void JsonFunctions::json_path_prepare(doris_udf::FunctionContext* context,
+void JsonFunctions::json_function_prepare(doris_udf::FunctionContext* context,
                                       doris_udf::FunctionContext::FunctionStateScope scope) {
     if (scope != FunctionContext::FRAGMENT_LOCAL) {
         return;
     }
 
-    if (!context->is_arg_constant(1)) {
+    if (!context->is_arg_constant(0) && !context->is_arg_constant(1)) {
         return;
     }
+    StringVal* json_str = reinterpret_cast<StringVal*>(context->get_constant_arg(0));

Review comment:
       The first argument may NOT be constant, so `get_constant_arg` may return nullptr.

##########
File path: gensrc/script/doris_builtins_functions.py
##########
@@ -1096,33 +1096,33 @@
     # Json functions
     [['get_json_int'], 'INT', ['VARCHAR', 'VARCHAR'],
         '_ZN5doris13JsonFunctions12get_json_intEPN9doris_udf15FunctionContextERKNS1_9StringValES6_',
-        '_ZN5doris13JsonFunctions17json_path_prepareEPN9doris_udf15FunctionContextENS2_18FunctionStateScopeE',
-        '_ZN5doris13JsonFunctions15json_path_closeEPN9doris_udf15FunctionContextENS2_18FunctionStateScopeE',
+        '_ZN5doris13JsonFunctions21json_function_prepareEPN9doris_udf15FunctionContextENS2_18FunctionStateScopeE',

Review comment:
       Modify signature may because FE-BE incompatible when upgrading. So better not changing it.




-- 
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