yiguolei commented on code in PR #48368: URL: https://github.com/apache/doris/pull/48368#discussion_r1974590573
########## be/src/runtime/result_block_buffer.h: ########## @@ -0,0 +1,132 @@ +// 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 <arrow/type.h> +#include <cctz/time_zone.h> +#include <gen_cpp/PaloInternalService_types.h> +#include <gen_cpp/Types_types.h> + +#include <atomic> +#include <condition_variable> +#include <cstdint> +#include <deque> +#include <list> +#include <memory> +#include <mutex> +#include <unordered_map> + +#include "common/status.h" +#include "runtime/runtime_state.h" + +namespace google::protobuf { +class Closure; +} // namespace google::protobuf + +namespace brpc { +class Controller; +} + +namespace doris { + +namespace pipeline { +class Dependency; +} // namespace pipeline + +namespace vectorized { +class Block; +} // namespace vectorized + +class PFetchDataResult; + +class ResultBlockBufferBase { +public: + ResultBlockBufferBase() = default; + virtual ~ResultBlockBufferBase() = default; + + template <class TARGET> + TARGET* cast() { + DCHECK(dynamic_cast<TARGET*>(this)) + << " Mismatch type! Current type is " << typeid(*this).name() + << " and expect type is" << typeid(TARGET).name(); + return reinterpret_cast<TARGET*>(this); + } + template <class TARGET> + const TARGET* cast() const { + DCHECK(dynamic_cast<const TARGET*>(this)) + << " Mismatch type! Current type is " << typeid(*this).name() + << " and expect type is" << typeid(TARGET).name(); + return reinterpret_cast<const TARGET*>(this); + } + virtual Status close(const TUniqueId& id, Status exec_status, int64_t num_rows) = 0; + virtual void cancel(const Status& reason) = 0; + + [[nodiscard]] virtual const TUniqueId& fragment_id() const = 0; + [[nodiscard]] virtual std::shared_ptr<MemTrackerLimiter> mem_tracker() = 0; + virtual void set_dependency(const TUniqueId& id, + std::shared_ptr<pipeline::Dependency> result_sink_dependency) = 0; +}; + +// This is used to serialize a result block by normal queries / arrow flight queries / point queries. +template <typename ResultCtxType, typename InBlockType> +class ResultBlockBuffer : public ResultBlockBufferBase { Review Comment: 是不是只有ResultBlockBuffer 这一个子类,如果是的话,为什么要把这个base和这个类分成两个,而不是一个? -- 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