be/src/storage/segment/stream_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 <memory> |
21 | | |
22 | | #include "core/column/column.h" |
23 | | #include "core/column/subcolumn_tree.h" |
24 | | #include "core/data_type/data_type.h" |
25 | | |
26 | | namespace doris::segment_v2 { |
27 | | |
28 | | // This file Defined ColumnIterator and ColumnReader for reading variant subcolumns. The types from read schema and from storage are |
29 | | // different, so we need to wrap the ColumnIterator from execution phase and storage column reading phase.And we also |
30 | | // maintain the tree structure to get the full JSON structure for variants. |
31 | | |
32 | | // Wrapped ColumnIterator from execution phase, the type is from read schema |
33 | | class ColumnIterator; |
34 | | class ColumnReader; |
35 | | |
36 | | struct SubstreamIterator { |
37 | | MutableColumnPtr column; |
38 | | std::unique_ptr<ColumnIterator> iterator; |
39 | | std::shared_ptr<const IDataType> type; |
40 | | std::shared_ptr<DataTypeSerDe> serde; |
41 | | bool inited = false; |
42 | | size_t rows_read = 0; |
43 | 131 | SubstreamIterator() = default; |
44 | | SubstreamIterator(MutableColumnPtr&& col, std::unique_ptr<ColumnIterator>&& it, |
45 | | std::shared_ptr<const IDataType> t); |
46 | | }; |
47 | | |
48 | | // path -> SubstreamIterator |
49 | | using SubstreamReaderTree = SubcolumnsTree<SubstreamIterator, false>; |
50 | | |
51 | | // Meta for the storage layer, the file_column_type indicates the read type of the column in segment file |
52 | | struct SubcolumnMeta { |
53 | | std::shared_ptr<const IDataType> file_column_type; |
54 | | int32_t footer_ordinal = -1; |
55 | | }; |
56 | | using SubcolumnColumnMetaInfo = SubcolumnsTree<SubcolumnMeta, true>; |
57 | | |
58 | | } // namespace doris::segment_v2 |