xiaokang commented on code in PR #10322: URL: https://github.com/apache/doris/pull/10322#discussion_r923961127
########## be/src/runtime/json_value.h: ########## @@ -0,0 +1,135 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#ifndef DORIS_BE_RUNTIME_JSON_VALUE_H +#define DORIS_BE_RUNTIME_JSON_VALUE_H + +#include "udf/udf.h" +#include "util/cpu_info.h" +#include "util/hash_util.hpp" +#include "util/jsonb_error.h" +#include "util/jsonb_parser.h" +#include "util/jsonb_utils.h" +#include "vec/common/string_ref.h" + +#ifdef __SSE4_2__ +#include "util/sse_util.hpp" +#endif + +namespace doris { + +struct JsonValue { + static const int MAX_LENGTH = (1 << 30); + + const char* ptr; + size_t len; + JsonbParser parser; + + JsonValue() : ptr(nullptr), len(0) {} + + JsonValue(char* ptr, int len) { + DCHECK_LE(len, MAX_LENGTH); + DCHECK(parser.parse(const_cast<const char*>(ptr), len)); + this->ptr = parser.getWriter().getOutput()->getBuffer(); + this->len = (unsigned)parser.getWriter().getOutput()->getSize(); + } + + JsonValue(const char* ptr, int len) { Review Comment: we should extract it to a common method accept const char*, and call it in char* and string version. -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org