forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaimon_cpp_reader.h
More file actions
101 lines (85 loc) · 3.5 KB
/
Copy pathpaimon_cpp_reader.h
File metadata and controls
101 lines (85 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// 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 <cstddef>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "cctz/time_zone.h"
#include "common/status.h"
#include "format/generic_reader.h"
#include "paimon/reader/batch_reader.h"
#include "paimon/table/source/split.h"
#include "storage/olap_scan_common.h"
namespace paimon {
class TableRead;
class Predicate;
} // namespace paimon
namespace doris {
class RuntimeProfile;
class RuntimeState;
class SlotDescriptor;
} // namespace doris
namespace doris {
class Block;
class PaimonCppReader : public GenericReader {
ENABLE_FACTORY_CREATOR(PaimonCppReader);
public:
PaimonCppReader(const std::vector<SlotDescriptor*>& file_slot_descs, RuntimeState* state,
RuntimeProfile* profile, const TFileRangeDesc& range,
const TFileScanRangeParams* range_params);
~PaimonCppReader() override;
Status init_reader();
Status _do_get_next_block(Block* block, size_t* read_rows, bool* eof) override;
Status _get_columns_impl(std::unordered_map<std::string, DataTypePtr>* name_to_type) override;
Status close() override;
void set_predicate(std::shared_ptr<paimon::Predicate> predicate) {
_predicate = std::move(predicate);
}
protected:
Status on_before_init_reader(ReaderInitContext* ctx) override;
Status on_after_read_block(Block* block, size_t* read_rows) override;
Status _do_init_reader(ReaderInitContext* /*ctx*/) override { return init_reader(); }
private:
Status _fill_partition_columns(Block* block, size_t num_rows);
Status _init_paimon_reader();
Status _decode_split(std::shared_ptr<paimon::Split>* split);
// Resolve paimon table root path for schema/manifest lookup.
std::optional<std::string> _resolve_table_path() const;
std::vector<std::string> _build_read_columns() const;
std::map<std::string, std::string> _build_options() const;
const std::vector<SlotDescriptor*>& _file_slot_descs;
RuntimeState* _state = nullptr;
[[maybe_unused]] RuntimeProfile* _profile = nullptr;
const TFileRangeDesc& _range;
const TFileScanRangeParams* _range_params = nullptr;
std::shared_ptr<paimon::Split> _split;
std::unique_ptr<paimon::TableRead> _table_read;
std::unique_ptr<paimon::BatchReader> _batch_reader;
std::shared_ptr<paimon::Predicate> _predicate;
std::unordered_map<std::string, std::tuple<std::string, const SlotDescriptor*>>
_partition_values;
std::unordered_map<std::string, bool> _partition_value_is_null;
std::unordered_map<std::string, uint32_t> _col_name_to_block_idx;
int64_t _remaining_table_level_row_count = -1;
cctz::time_zone _ctzz;
};
} // namespace doris