eldenmoon commented on code in PR #65561: URL: https://github.com/apache/doris/pull/65561#discussion_r3619296600
########## be/src/exprs/function/parse/variant_json.h: ########## @@ -0,0 +1,404 @@ +// 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. + +#pragma once + +#include <array> +#include <cmath> +#include <cstddef> +#include <cstdint> +#include <memory> +#include <string> + +#include "common/status.h" +#include "core/value/variant/variant_encoded_block.h" +#include "core/value/variant/variant_value.h" + +namespace cctz { +class time_zone; +} + +namespace doris { + +// Formatting state supplied by the column adapter. A null time zone means UTC. +struct VariantJsonFormatOptions { + const cctz::time_zone* timezone = nullptr; +}; + +struct JsonToVariantOptions { + uint32_t max_json_key_length = 255; + bool throw_on_invalid_json = false; + bool check_duplicate_json_path = false; + + // Takes a value snapshot. Later changes to mutable config do not affect an encoder. + static JsonToVariantOptions current_config(); +}; + +// Reuses one JSON parser and one block builder. Each add_json() collects into a stack-only row; +// finish_block() performs pass 2. A failed add_json() is terminal, as is a successful +// finish_block(). try_add_json() rolls back invalid input rows and keeps collecting. +class JsonToVariantEncoder { Review Comment: 重命名成JsonStringToVariantEncoder -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
