Coverage Report

Created: 2026-03-13 21:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/load/group_commit/wal/wal_reader.h
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#pragma once
19
#include "format/generic_reader.h"
20
#include "load/group_commit/wal/wal_file_reader.h"
21
#include "runtime/descriptors.h"
22
23
namespace doris {
24
#include "common/compile_check_begin.h"
25
struct ScannerCounter;
26
class WalReader : public GenericReader {
27
    ENABLE_FACTORY_CREATOR(WalReader);
28
29
public:
30
    WalReader(RuntimeState* state);
31
0
    ~WalReader() override = default;
32
    Status init_reader(const TupleDescriptor* tuple_descriptor);
33
    Status get_next_block(Block* block, size_t* read_rows, bool* eof) override;
34
    Status get_columns(std::unordered_map<std::string, DataTypePtr>* name_to_type,
35
                       std::unordered_set<std::string>* missing_cols) override;
36
37
0
    Status close() override {
38
0
        if (_wal_reader) {
39
0
            return _wal_reader->finalize();
40
0
        }
41
0
        return Status::OK();
42
0
    }
43
44
private:
45
    RuntimeState* _state = nullptr;
46
    int64_t _wal_id;
47
    std::string _wal_path;
48
    std::shared_ptr<doris::WalFileReader> _wal_reader = nullptr;
49
    const TupleDescriptor* _tuple_descriptor = nullptr;
50
    // column_id, column_pos
51
    std::map<int64_t, int64_t> _column_pos_map;
52
    int64_t _column_id_count;
53
    uint32_t _version = 0;
54
};
55
#include "common/compile_check_end.h"
56
} // namespace doris