be/src/format_v2/table/load_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 | | |
20 | | #include "format_v2/table_reader.h" |
21 | | |
22 | | namespace doris::format { |
23 | | |
24 | | // Adapts the existing file-load source/destination tuple protocol to a table reader. |
25 | | // Source materialization uses TableReader; finalization returns the destination schema. |
26 | | class LoadTableReader : public TableReader { |
27 | | public: |
28 | | LoadTableReader(TupleDescriptor* source, const TupleDescriptor* destination); |
29 | | ~LoadTableReader() override; |
30 | | |
31 | | Status init(TableReadOptions&& options) override; |
32 | | Status prepare_split(const SplitReadOptions& options) override; |
33 | | Status refresh_conjuncts(VExprContextSPtrs conjuncts) override; |
34 | 0 | bool current_split_uses_metadata_count() const override { return false; } |
35 | | Status abort_split() override; |
36 | | Status close() override; |
37 | 0 | int64_t condition_cache_hit_count() const override { return 0; } |
38 | | |
39 | | protected: |
40 | | Status finalize_chunk(Block* block, size_t rows) override; |
41 | | Status validate_file_mapping(const TableColumnMapper& mapper) const override; |
42 | | Status customize_file_scan_request(FileScanRequest* request) override; |
43 | | Status create_file_reader(std::unique_ptr<FileReader>* reader) override; |
44 | | TableColumnMappingMode mapping_mode() const override; |
45 | | |
46 | | private: |
47 | | Status _init_source_columns(); |
48 | | Status _materialize_missing_values(); |
49 | | Status _convert(Block* output); |
50 | | Status _reject_row(size_t row, const std::string& reason); |
51 | | |
52 | | TupleDescriptor* _source_tuple; |
53 | | const TupleDescriptor* _destination_tuple; |
54 | | RowDescriptor _source_row; |
55 | | Block _source; |
56 | | std::vector<ColumnDefinition> _source_columns; |
57 | | std::vector<SlotDescriptor*> _source_file_slots; |
58 | | VExprContextSPtrs _pre_filters; |
59 | | VExprContextSPtrs _destination_exprs; |
60 | | std::map<size_t, VExprContextSPtr> _source_defaults; |
61 | | std::vector<int> _direct_source_positions; |
62 | | std::vector<int> _partition_positions; |
63 | | int _skip_bitmap_position = -1; |
64 | | int _sequence_map_uid = -1; |
65 | | int _sequence_uid = -1; |
66 | | bool _closed = false; |
67 | | }; |
68 | | |
69 | | } // namespace doris::format |