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 2020/04/18 15:59:52 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #3230: Support load json-data into Doris by RoutineLoad or StreamLoad

morningman commented on a change in pull request #3230: Support load json-data into Doris by RoutineLoad or StreamLoad
URL: https://github.com/apache/incubator-doris/pull/3230#discussion_r410703515
 
 

 ##########
 File path: be/src/exprs/json_functions.cpp
 ##########
 @@ -107,75 +107,28 @@ DoubleVal JsonFunctions::get_json_double(
     }
 }
 
-rapidjson::Value* JsonFunctions::get_json_object(
-        FunctionContext* context,
-        const std::string& json_string,
-        const std::string& path_string,
-        const JsonFunctionType& fntype,
-        rapidjson::Document* document) {
-
-    // split path by ".", and escape quota by "\"
-    // eg:
-    //    '$.text#abc.xyz'  ->  [$, text#abc, xyz]
-    //    '$."text.abc".xyz'  ->  [$, text.abc, xyz]
-    //    '$."text.abc"[1].xyz'  ->  [$, text.abc[1], xyz]
-    std::vector<JsonPath>* parsed_paths;
-    std::vector<JsonPath> tmp_parsed_paths;
-#ifndef BE_TEST
-    parsed_paths = reinterpret_cast<std::vector<JsonPath>*>(context->get_function_state(FunctionContext::FRAGMENT_LOCAL));
-    if (parsed_paths == nullptr) {
-        boost::tokenizer<boost::escaped_list_separator<char> > tok(path_string, boost::escaped_list_separator<char>("\\", ".", "\""));
-        std::vector<std::string> paths(tok.begin(), tok.end());
-        get_parsed_paths(paths, &tmp_parsed_paths);
-        parsed_paths = &tmp_parsed_paths;
-    }
-#else
-    boost::tokenizer<boost::escaped_list_separator<char> > tok(path_string, boost::escaped_list_separator<char>("\\", ".", "\""));
-    std::vector<std::string> paths(tok.begin(), tok.end());
-    get_parsed_paths(paths, &tmp_parsed_paths);
-    parsed_paths = &tmp_parsed_paths;
-#endif
-
-    VLOG(10) << "first parsed path: " << (*parsed_paths)[0].debug_string();
-
-    if (!(*parsed_paths)[0].is_valid) {
-        return document;
-    }
-
-    if (UNLIKELY((*parsed_paths).size() == 1)) {
-        if (fntype == JSON_FUN_STRING) {
-            document->SetString(json_string.c_str(), document->GetAllocator());
-        } else {
-            return document;
-        }
-    }
-
-    //rapidjson::Document document;
-    document->Parse(json_string.c_str());
-    if (UNLIKELY(document->HasParseError())) {
-        VLOG(1) << "Error at offset " << document->GetErrorOffset()
-            << ": " << GetParseError_En(document->GetParseError());
-        document->SetNull();
-        return document;
-    }
 
+rapidjson::Value* JsonFunctions::match_value(std::vector<JsonPath>& parsed_paths, rapidjson::Document* document) {
+    //bool is_arr_set_by_last = false;
 
 Review comment:
   Remove the unused variables

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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