This is an automated email from the ASF dual-hosted git repository.

HappenLee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 67651ae0229 [chore](jsonb) Remove unused code in function_jsonb 
(#64129)
67651ae0229 is described below

commit 67651ae02299ce6675a2bb40794ad24c4548bc64
Author: Jerry Hu <[email protected]>
AuthorDate: Sun Jun 21 18:26:57 2026 +0800

    [chore](jsonb) Remove unused code in function_jsonb (#64129)
    
    This PR removes several pieces of redundant or unused code from
    `function_jsonb.cpp`:
    
    - Remove unused `JsonbToJson` formatter plumbing from
    `JsonbExtractStringImpl`.
    - Remove an unused `path_string` temporary in `build_parents_by_path`.
    - Remove a redundant `DORIS_CHECK_GE` before the user-facing
    `InvalidArgument` check in `json_remove`.
    - Remove an unused `path_constants_vec` in `FunctionJsonbRemove`.
---
 be/src/exprs/function/function_jsonb.cpp | 29 ++++++-----------------------
 1 file changed, 6 insertions(+), 23 deletions(-)

diff --git a/be/src/exprs/function/function_jsonb.cpp 
b/be/src/exprs/function/function_jsonb.cpp
index b557a346aa0..73481181a58 100644
--- a/be/src/exprs/function/function_jsonb.cpp
+++ b/be/src/exprs/function/function_jsonb.cpp
@@ -59,7 +59,6 @@
 #include "exprs/function/simple_function_factory.h"
 #include "exprs/function_context.h"
 #include "util/jsonb_document.h"
-#include "util/jsonb_stream.h"
 #include "util/jsonb_utils.h"
 #include "util/jsonb_writer.h"
 #include "util/simd/bits.h"
@@ -863,7 +862,6 @@ private:
     static ALWAYS_INLINE void inner_loop_impl(JsonbWriter* writer, size_t i,
                                               ColumnString::Chars& res_data,
                                               ColumnString::Offsets& 
res_offsets, NullMap& null_map,
-                                              std::unique_ptr<JsonbToJson>& 
formater,
                                               const char* l_raw, size_t 
l_size, JsonbPath& path) {
         // doc is NOT necessary to be deleted since JsonbDocument will not 
allocate memory
         const JsonbDocument* doc = nullptr;
@@ -924,7 +922,6 @@ public:
         res_offsets.resize(input_rows_count);
 
         auto writer = std::make_unique<JsonbWriter>();
-        std::unique_ptr<JsonbToJson> formater;
 
         // reuseable json path list, espacially for const path
         std::vector<JsonbPath> json_path_list;
@@ -988,8 +985,8 @@ public:
                 }
 
                 writer->reset();
-                inner_loop_impl(writer.get(), i, res_data, res_offsets, 
null_map, formater, l_raw,
-                                l_size, json_path_list[0]);
+                inner_loop_impl(writer.get(), i, res_data, res_offsets, 
null_map, l_raw, l_size,
+                                json_path_list[0]);
             } else { // will make array string to user
                 writer->reset();
                 bool has_value = false;
@@ -1054,8 +1051,6 @@ public:
         size_t input_rows_count = loffsets.size();
         res_offsets.resize(input_rows_count);
 
-        std::unique_ptr<JsonbToJson> formater;
-
         JsonbWriter writer;
         for (size_t i = 0; i < input_rows_count; ++i) {
             if (l_null_map && (*l_null_map)[i]) {
@@ -1082,8 +1077,7 @@ public:
             }
 
             writer.reset();
-            inner_loop_impl(&writer, i, res_data, res_offsets, null_map, 
formater, l_raw, l_size,
-                            path);
+            inner_loop_impl(&writer, i, res_data, res_offsets, null_map, 
l_raw, l_size, path);
         } //for
         return Status::OK();
     } //function
@@ -1095,8 +1089,6 @@ public:
         size_t input_rows_count = loffsets.size();
         res_offsets.resize(input_rows_count);
 
-        std::unique_ptr<JsonbToJson> formater;
-
         JsonbPath path;
         if (!path.seek(rdata.data, rdata.size)) {
             return Status::InvalidArgument("Json path error: Invalid Json Path 
for value: {}",
@@ -1114,8 +1106,7 @@ public:
             const char* l_raw = reinterpret_cast<const 
char*>(&ldata[loffsets[i - 1]]);
 
             writer.reset();
-            inner_loop_impl(&writer, i, res_data, res_offsets, null_map, 
formater, l_raw, l_size,
-                            path);
+            inner_loop_impl(&writer, i, res_data, res_offsets, null_map, 
l_raw, l_size, path);
         } //for
         return Status::OK();
     } //function
@@ -1128,8 +1119,6 @@ public:
         size_t input_rows_count = roffsets.size();
         res_offsets.resize(input_rows_count);
 
-        std::unique_ptr<JsonbToJson> formater;
-
         JsonbWriter writer;
 
         for (size_t i = 0; i < input_rows_count; ++i) {
@@ -1149,8 +1138,8 @@ public:
             }
 
             writer.reset();
-            inner_loop_impl(&writer, i, res_data, res_offsets, null_map, 
formater, ldata.data,
-                            ldata.size, path);
+            inner_loop_impl(&writer, i, res_data, res_offsets, null_map, 
ldata.data, ldata.size,
+                            path);
         } //for
         return Status::OK();
     } //function
@@ -2124,8 +2113,6 @@ public:
 
         auto find_result = root->findValue(current);
         if (!find_result.value) {
-            std::string path_string;
-            current.to_string(&path_string);
             return false;
         } else if (find_result.value == root) {
             return true;
@@ -2712,8 +2699,6 @@ public:
 
     Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
                         uint32_t result, size_t input_rows_count) const 
override {
-        DORIS_CHECK_GE(arguments.size(), 2);
-
         // Check if arguments count is valid (json_doc + at least one path)
         if (arguments.size() < 2) {
             return Status::InvalidArgument("json_remove requires at least 2 
arguments");
@@ -2820,7 +2805,6 @@ public:
             }
 
             std::vector<JsonbPath> paths;
-            std::vector<bool> path_constants_vec;
 
             for (size_t path_idx = 0; path_idx < path_columns.size(); 
++path_idx) {
                 size_t idx = index_check_const(row_idx, 
path_constants[path_idx]);
@@ -2841,7 +2825,6 @@ public:
                 }
 
                 paths.push_back(std::move(path));
-                path_constants_vec.push_back(path_constants[path_idx]);
             }
 
             const JsonbValue* current_value = json_doc->getValue();


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

Reply via email to