github-actions[bot] commented on code in PR #15624: URL: https://github.com/apache/doris/pull/15624#discussion_r1062517667
########## be/test/vec/core/block_spill_test.cpp: ########## @@ -55,14 +57,21 @@ std::vector<StorePath> paths; paths.emplace_back(test_data_dir, -1); block_spill_manager = std::make_shared<BlockSpillManager>(paths); + block_spill_manager->init(); } static void TearDownTestSuite() { FileUtils::remove_all(test_data_dir); } protected: - void SetUp() {} + void SetUp() { + _env = ExecEnv::GetInstance(); + _env->_block_spill_mgr = block_spill_manager.get(); Review Comment: warning: '_block_spill_mgr' is a private member of 'doris::ExecEnv' [clang-diagnostic-error] ```cpp _env->_block_spill_mgr = block_spill_manager.get(); ^ ``` **be/src/runtime/exec_env.h:278:** declared private here ```cpp BlockSpillManager* _block_spill_mgr = nullptr; ^ ``` ########## be/src/vec/core/block_spill_reader.h: ########## @@ -25,25 +25,53 @@ namespace vectorized { // Read data spilled to local file. class BlockSpillReader { public: - BlockSpillReader(const std::string& file_path) : file_path_(file_path) {} + BlockSpillReader(int64_t stream_id, const std::string& file_path, bool delete_after_read = true) + : stream_id_(stream_id), file_path_(file_path), delete_after_read_(delete_after_read) {} + + ~BlockSpillReader() { close(); } Status open(); - Status close() { - file_reader_.reset(); - return Status::OK(); + Status close(); + + Status read(Block** block); + + int64_t get_id() const { return stream_id_; } + + std::string get_path() const { return file_path_; } + + int64_t get_read_time(bool reset = false) { + auto time = read_time_; + if (reset) { + read_time_ = 0; + } + return time; } - // read a small block, set eof to true if no more data to read - Status read(Block& block, bool& eof); + int64_t get_deserialize_time(bool reset = false) { + auto time = deserialize_time_; + if (reset) { + deserialize_time_ = 0; + } + return time; + } private: + int64_t stream_id_; std::string file_path_; + bool delete_after_read_; io::FileReaderSPtr file_reader_; size_t block_count_ = 0; size_t read_block_index_ = 0; + size_t max_sub_block_size_ = 0; + std::unique_ptr<char[]> read_buff_; std::vector<size_t> block_start_offsets_; + std::unique_ptr<Block> current_block_; + + size_t read_bytes_ = 0; Review Comment: warning: private field 'read_bytes_' is not used [clang-diagnostic-unused-private-field] ```cpp size_t read_bytes_ = 0; ^ ``` ########## be/test/vec/core/block_spill_test.cpp: ########## @@ -55,14 +57,21 @@ class TestBlockSpill : public testing::Test { std::vector<StorePath> paths; paths.emplace_back(test_data_dir, -1); block_spill_manager = std::make_shared<BlockSpillManager>(paths); + block_spill_manager->init(); } static void TearDownTestSuite() { FileUtils::remove_all(test_data_dir); } protected: - void SetUp() {} + void SetUp() { Review Comment: warning: annotate this function with 'override' or (rarely) 'final' [modernize-use-override] ```suggestion void SetUp() override { ``` -- 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