be/src/cloud/pb_convert.cpp
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 | | #include "cloud/pb_convert.h" |
19 | | |
20 | | #include <gen_cpp/olap_file.pb.h> |
21 | | |
22 | | #include <utility> |
23 | | |
24 | | #include "common/logging.h" |
25 | | |
26 | | namespace doris::cloud { |
27 | | |
28 | 0 | RowsetMetaCloudPB doris_rowset_meta_to_cloud(const RowsetMetaPB& in) { |
29 | 0 | RowsetMetaCloudPB out; |
30 | 0 | doris_rowset_meta_to_cloud(&out, in); |
31 | 0 | return out; |
32 | 0 | } |
33 | | |
34 | 57.7k | RowsetMetaCloudPB doris_rowset_meta_to_cloud(RowsetMetaPB&& in) { |
35 | 57.7k | RowsetMetaCloudPB out; |
36 | 57.7k | doris_rowset_meta_to_cloud(&out, std::move(in)); |
37 | 57.7k | return out; |
38 | 57.7k | } |
39 | | |
40 | 4 | void doris_rowset_meta_to_cloud(RowsetMetaCloudPB* out, const RowsetMetaPB& in) { |
41 | | // ATTN: please keep the set order aligned with the definition of proto `TabletSchemaCloudPB`. |
42 | 4 | out->set_rowset_id(in.rowset_id()); |
43 | 4 | out->set_partition_id(in.partition_id()); |
44 | 4 | out->set_tablet_id(in.tablet_id()); |
45 | 4 | out->set_txn_id(in.txn_id()); |
46 | 4 | out->set_tablet_schema_hash(in.tablet_schema_hash()); |
47 | 4 | out->set_rowset_type(in.rowset_type()); |
48 | 4 | out->set_rowset_state(in.rowset_state()); |
49 | 4 | out->set_start_version(in.start_version()); |
50 | 4 | out->set_end_version(in.end_version()); |
51 | 4 | out->set_version_hash(in.version_hash()); |
52 | 4 | out->set_num_rows(in.num_rows()); |
53 | 4 | out->set_total_disk_size(in.total_disk_size()); |
54 | 4 | out->set_data_disk_size(in.data_disk_size()); |
55 | 4 | out->set_index_disk_size(in.index_disk_size()); |
56 | 4 | out->mutable_zone_maps()->CopyFrom(in.zone_maps()); |
57 | 4 | if (in.has_delete_predicate()) { |
58 | 1 | out->mutable_delete_predicate()->CopyFrom(in.delete_predicate()); |
59 | 1 | } |
60 | 4 | out->set_empty(in.empty()); |
61 | 4 | if (in.has_load_id()) { |
62 | 1 | out->mutable_load_id()->CopyFrom(in.load_id()); |
63 | 1 | } |
64 | 4 | out->set_delete_flag(in.delete_flag()); |
65 | 4 | out->set_creation_time(in.creation_time()); |
66 | 4 | if (in.has_tablet_uid()) { |
67 | 1 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
68 | 1 | } |
69 | 4 | out->set_num_segments(in.num_segments()); |
70 | 4 | out->set_rowset_id_v2(in.rowset_id_v2()); |
71 | 4 | out->set_resource_id(in.resource_id()); |
72 | 4 | out->set_newest_write_timestamp(in.newest_write_timestamp()); |
73 | 4 | out->mutable_segments_key_bounds()->CopyFrom(in.segments_key_bounds()); |
74 | 4 | if (in.has_tablet_schema()) { |
75 | 1 | doris_tablet_schema_to_cloud(out->mutable_tablet_schema(), in.tablet_schema()); |
76 | 1 | } |
77 | 4 | if (in.has_schema_dict_key_list()) { |
78 | 1 | out->mutable_schema_dict_key_list()->CopyFrom(in.schema_dict_key_list()); |
79 | 1 | } |
80 | 4 | out->set_txn_expiration(in.txn_expiration()); |
81 | 4 | out->set_segments_overlap_pb(in.segments_overlap_pb()); |
82 | 4 | out->set_segments_key_bounds_truncated(in.segments_key_bounds_truncated()); |
83 | 4 | out->mutable_num_segment_rows()->CopyFrom(in.num_segment_rows()); |
84 | 4 | out->mutable_segments_file_size()->CopyFrom(in.segments_file_size()); |
85 | 4 | out->set_index_id(in.index_id()); |
86 | 4 | if (in.has_schema_version()) { |
87 | | // See cloud/src/meta-service/meta_service_schema.cpp for details. |
88 | 1 | out->set_schema_version(in.schema_version()); |
89 | 1 | } |
90 | 4 | out->set_enable_segments_file_size(in.enable_segments_file_size()); |
91 | 4 | out->set_has_variant_type_in_schema(in.has_variant_type_in_schema()); |
92 | 4 | out->set_enable_inverted_index_file_info(in.enable_inverted_index_file_info()); |
93 | 4 | out->set_compaction_level(in.compaction_level()); |
94 | 4 | out->mutable_inverted_index_file_info()->CopyFrom(in.inverted_index_file_info()); |
95 | 4 | out->set_source_rowset_id(in.source_rowset_id()); |
96 | 4 | out->set_source_tablet_id(in.source_tablet_id()); |
97 | 4 | if (in.has___split_schema()) { |
98 | 1 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
99 | 1 | } |
100 | 4 | if (in.has_visible_ts_ms()) { |
101 | 1 | out->set_visible_ts_ms(in.visible_ts_ms()); |
102 | 1 | } |
103 | 4 | if (in.has_reference_instance_id()) { |
104 | 1 | out->set_reference_instance_id(in.reference_instance_id()); |
105 | 1 | } |
106 | 4 | auto* slice_locations = out->mutable_packed_slice_locations(); |
107 | 4 | slice_locations->clear(); |
108 | 4 | slice_locations->insert(in.packed_slice_locations().begin(), in.packed_slice_locations().end()); |
109 | 4 | if (in.has_is_recycled()) { |
110 | 1 | out->set_is_recycled(in.is_recycled()); |
111 | 1 | } |
112 | 4 | if (in.has_job_id()) { |
113 | 1 | out->set_job_id(in.job_id()); |
114 | 1 | } |
115 | 4 | if (in.has_commit_tso()) { |
116 | 1 | out->set_commit_tso(in.commit_tso()); |
117 | 1 | } |
118 | 4 | } |
119 | | |
120 | 204k | void doris_rowset_meta_to_cloud(RowsetMetaCloudPB* out, RowsetMetaPB&& in) { |
121 | | // ATTN: please keep the set order aligned with the definition of proto `TabletSchemaCloudPB`. |
122 | 204k | out->set_rowset_id(in.rowset_id()); |
123 | 204k | out->set_partition_id(in.partition_id()); |
124 | 204k | out->set_tablet_id(in.tablet_id()); |
125 | 204k | out->set_txn_id(in.txn_id()); |
126 | 204k | out->set_tablet_schema_hash(in.tablet_schema_hash()); |
127 | 204k | out->set_rowset_type(in.rowset_type()); |
128 | 204k | out->set_rowset_state(in.rowset_state()); |
129 | 204k | out->set_start_version(in.start_version()); |
130 | 204k | out->set_end_version(in.end_version()); |
131 | 204k | out->set_version_hash(in.version_hash()); |
132 | 204k | out->set_num_rows(in.num_rows()); |
133 | 204k | out->set_total_disk_size(in.total_disk_size()); |
134 | 204k | out->set_data_disk_size(in.data_disk_size()); |
135 | 204k | out->set_index_disk_size(in.index_disk_size()); |
136 | 204k | out->mutable_zone_maps()->Swap(in.mutable_zone_maps()); |
137 | 204k | if (in.has_delete_predicate()) { |
138 | 6.53k | out->mutable_delete_predicate()->Swap(in.mutable_delete_predicate()); |
139 | 6.53k | } |
140 | 204k | out->set_empty(in.empty()); |
141 | 204k | if (in.has_load_id()) { |
142 | 161k | out->mutable_load_id()->CopyFrom(in.load_id()); |
143 | 161k | } |
144 | 204k | out->set_delete_flag(in.delete_flag()); |
145 | 204k | out->set_creation_time(in.creation_time()); |
146 | 204k | if (in.has_tablet_uid()) { |
147 | 29.0k | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
148 | 29.0k | } |
149 | 204k | out->set_num_segments(in.num_segments()); |
150 | 204k | out->set_rowset_id_v2(in.rowset_id_v2()); |
151 | 204k | out->set_resource_id(in.resource_id()); |
152 | 204k | out->set_newest_write_timestamp(in.newest_write_timestamp()); |
153 | 204k | out->mutable_segments_key_bounds()->Swap(in.mutable_segments_key_bounds()); |
154 | 204k | if (in.has_tablet_schema()) { |
155 | 73.1k | doris_tablet_schema_to_cloud(out->mutable_tablet_schema(), |
156 | 73.1k | std::move(*in.mutable_tablet_schema())); |
157 | 73.1k | } |
158 | 204k | if (in.has_schema_dict_key_list()) { |
159 | 43 | out->mutable_schema_dict_key_list()->Swap(in.mutable_schema_dict_key_list()); |
160 | 43 | } |
161 | 204k | out->set_txn_expiration(in.txn_expiration()); |
162 | 204k | out->set_segments_overlap_pb(in.segments_overlap_pb()); |
163 | 204k | out->set_segments_key_bounds_truncated(in.segments_key_bounds_truncated()); |
164 | 204k | out->mutable_num_segment_rows()->Swap(in.mutable_num_segment_rows()); |
165 | 204k | out->mutable_segments_file_size()->Swap(in.mutable_segments_file_size()); |
166 | 204k | out->set_index_id(in.index_id()); |
167 | 204k | if (in.has_schema_version()) { |
168 | | // See cloud/src/meta-service/meta_service_schema.cpp for details. |
169 | 203k | out->set_schema_version(in.schema_version()); |
170 | 203k | } |
171 | 204k | out->set_enable_segments_file_size(in.enable_segments_file_size()); |
172 | 204k | out->set_has_variant_type_in_schema(in.has_variant_type_in_schema()); |
173 | 204k | out->set_enable_inverted_index_file_info(in.enable_inverted_index_file_info()); |
174 | 204k | out->set_compaction_level(in.compaction_level()); |
175 | 204k | out->mutable_inverted_index_file_info()->Swap(in.mutable_inverted_index_file_info()); |
176 | 204k | out->set_source_rowset_id(in.source_rowset_id()); |
177 | 204k | out->set_source_tablet_id(in.source_tablet_id()); |
178 | | |
179 | 204k | if (in.has___split_schema()) { |
180 | 2 | out->mutable___split_schema()->Swap(in.mutable___split_schema()); |
181 | 2 | } |
182 | 204k | if (in.has_visible_ts_ms()) { |
183 | 36.2k | out->set_visible_ts_ms(in.visible_ts_ms()); |
184 | 36.2k | } |
185 | 204k | if (in.has_reference_instance_id()) { |
186 | 2 | out->set_reference_instance_id(in.reference_instance_id()); |
187 | 2 | } |
188 | 204k | auto* slice_locations = out->mutable_packed_slice_locations(); |
189 | 204k | slice_locations->clear(); |
190 | 204k | slice_locations->insert(in.packed_slice_locations().begin(), in.packed_slice_locations().end()); |
191 | 204k | if (in.has_is_recycled()) { |
192 | 2 | out->set_is_recycled(in.is_recycled()); |
193 | 2 | } |
194 | 204k | if (in.has_job_id()) { |
195 | 175k | out->set_job_id(in.job_id()); |
196 | 175k | } |
197 | 204k | if (in.has_commit_tso()) { |
198 | 2 | out->set_commit_tso(in.commit_tso()); |
199 | 2 | } |
200 | 204k | } |
201 | | |
202 | 126k | RowsetMetaPB cloud_rowset_meta_to_doris(const RowsetMetaCloudPB& in) { |
203 | 126k | RowsetMetaPB out; |
204 | 126k | cloud_rowset_meta_to_doris(&out, in); |
205 | 126k | return out; |
206 | 126k | } |
207 | | |
208 | 2 | RowsetMetaPB cloud_rowset_meta_to_doris(RowsetMetaCloudPB&& in) { |
209 | 2 | RowsetMetaPB out; |
210 | 2 | cloud_rowset_meta_to_doris(&out, std::move(in)); |
211 | 2 | return out; |
212 | 2 | } |
213 | | |
214 | 126k | void cloud_rowset_meta_to_doris(RowsetMetaPB* out, const RowsetMetaCloudPB& in) { |
215 | | // ATTN: please keep the set order aligned with the definition of proto `TabletSchemaCloudPB`. |
216 | 126k | out->set_rowset_id(in.rowset_id()); |
217 | 126k | out->set_partition_id(in.partition_id()); |
218 | 126k | out->set_tablet_id(in.tablet_id()); |
219 | 126k | out->set_txn_id(in.txn_id()); |
220 | 126k | out->set_tablet_schema_hash(in.tablet_schema_hash()); |
221 | 126k | out->set_rowset_type(in.rowset_type()); |
222 | 126k | out->set_rowset_state(in.rowset_state()); |
223 | 126k | out->set_start_version(in.start_version()); |
224 | 126k | out->set_end_version(in.end_version()); |
225 | 126k | out->set_version_hash(in.version_hash()); |
226 | 126k | out->set_num_rows(in.num_rows()); |
227 | 126k | out->set_total_disk_size(in.total_disk_size()); |
228 | 126k | out->set_data_disk_size(in.data_disk_size()); |
229 | 126k | out->set_index_disk_size(in.index_disk_size()); |
230 | 126k | out->mutable_zone_maps()->CopyFrom(in.zone_maps()); |
231 | 126k | if (in.has_delete_predicate()) { |
232 | 89 | out->mutable_delete_predicate()->CopyFrom(in.delete_predicate()); |
233 | 89 | } |
234 | 126k | out->set_empty(in.empty()); |
235 | 126k | if (in.has_load_id()) { |
236 | 5.98k | out->mutable_load_id()->CopyFrom(in.load_id()); |
237 | 5.98k | } |
238 | 126k | out->set_delete_flag(in.delete_flag()); |
239 | 126k | out->set_creation_time(in.creation_time()); |
240 | 126k | if (in.has_tablet_uid()) { |
241 | 1 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
242 | 1 | } |
243 | 126k | out->set_num_segments(in.num_segments()); |
244 | 126k | out->set_rowset_id_v2(in.rowset_id_v2()); |
245 | 126k | out->set_resource_id(in.resource_id()); |
246 | 126k | out->set_newest_write_timestamp(in.newest_write_timestamp()); |
247 | 126k | out->mutable_segments_key_bounds()->CopyFrom(in.segments_key_bounds()); |
248 | 126k | if (in.has_tablet_schema()) { |
249 | 126k | cloud_tablet_schema_to_doris(out->mutable_tablet_schema(), in.tablet_schema()); |
250 | 126k | } |
251 | 126k | if (in.has_schema_dict_key_list()) { |
252 | 751 | out->mutable_schema_dict_key_list()->CopyFrom(in.schema_dict_key_list()); |
253 | 751 | } |
254 | 126k | out->set_txn_expiration(in.txn_expiration()); |
255 | 126k | out->set_segments_overlap_pb(in.segments_overlap_pb()); |
256 | 126k | out->set_segments_key_bounds_truncated(in.segments_key_bounds_truncated()); |
257 | 126k | out->mutable_num_segment_rows()->CopyFrom(in.num_segment_rows()); |
258 | 126k | out->mutable_segments_file_size()->CopyFrom(in.segments_file_size()); |
259 | 126k | out->set_index_id(in.index_id()); |
260 | 126k | if (in.has_schema_version()) { |
261 | | // See cloud/src/meta-service/meta_service_schema.cpp for details. |
262 | 126k | out->set_schema_version(in.schema_version()); |
263 | 126k | } |
264 | 126k | out->set_enable_segments_file_size(in.enable_segments_file_size()); |
265 | 126k | out->set_has_variant_type_in_schema(in.has_variant_type_in_schema()); |
266 | 126k | out->set_enable_inverted_index_file_info(in.enable_inverted_index_file_info()); |
267 | 126k | out->set_compaction_level(in.compaction_level()); |
268 | 126k | out->mutable_inverted_index_file_info()->CopyFrom(in.inverted_index_file_info()); |
269 | 126k | out->set_source_rowset_id(in.source_rowset_id()); |
270 | 126k | out->set_source_tablet_id(in.source_tablet_id()); |
271 | 126k | if (in.has___split_schema()) { |
272 | 1 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
273 | 1 | } |
274 | 126k | if (in.has_visible_ts_ms()) { |
275 | 6.75k | out->set_visible_ts_ms(in.visible_ts_ms()); |
276 | 6.75k | } |
277 | 126k | if (in.has_reference_instance_id()) { |
278 | 1 | out->set_reference_instance_id(in.reference_instance_id()); |
279 | 1 | } |
280 | 126k | auto* slice_locations = out->mutable_packed_slice_locations(); |
281 | 126k | slice_locations->clear(); |
282 | 126k | slice_locations->insert(in.packed_slice_locations().begin(), in.packed_slice_locations().end()); |
283 | 126k | if (in.has_is_recycled()) { |
284 | 1 | out->set_is_recycled(in.is_recycled()); |
285 | 1 | } |
286 | 126k | if (in.has_job_id()) { |
287 | 6.75k | out->set_job_id(in.job_id()); |
288 | 6.75k | } |
289 | 126k | if (in.has_commit_tso()) { |
290 | 1 | out->set_commit_tso(in.commit_tso()); |
291 | 1 | } |
292 | 126k | } |
293 | | |
294 | 5 | void cloud_rowset_meta_to_doris(RowsetMetaPB* out, RowsetMetaCloudPB&& in) { |
295 | | // ATTN: please keep the set order aligned with the definition of proto `TabletSchemaCloudPB`. |
296 | 5 | out->set_rowset_id(in.rowset_id()); |
297 | 5 | out->set_partition_id(in.partition_id()); |
298 | 5 | out->set_tablet_id(in.tablet_id()); |
299 | 5 | out->set_txn_id(in.txn_id()); |
300 | 5 | out->set_tablet_schema_hash(in.tablet_schema_hash()); |
301 | 5 | out->set_rowset_type(in.rowset_type()); |
302 | 5 | out->set_rowset_state(in.rowset_state()); |
303 | 5 | out->set_start_version(in.start_version()); |
304 | 5 | out->set_end_version(in.end_version()); |
305 | 5 | out->set_version_hash(in.version_hash()); |
306 | 5 | out->set_num_rows(in.num_rows()); |
307 | 5 | out->set_total_disk_size(in.total_disk_size()); |
308 | 5 | out->set_data_disk_size(in.data_disk_size()); |
309 | 5 | out->set_index_disk_size(in.index_disk_size()); |
310 | 5 | out->mutable_zone_maps()->Swap(in.mutable_zone_maps()); |
311 | 5 | if (in.has_delete_predicate()) { |
312 | 2 | out->mutable_delete_predicate()->Swap(in.mutable_delete_predicate()); |
313 | 2 | } |
314 | 5 | out->set_empty(in.empty()); |
315 | 5 | if (in.has_load_id()) { |
316 | 2 | out->mutable_load_id()->CopyFrom(in.load_id()); |
317 | 2 | } |
318 | 5 | out->set_delete_flag(in.delete_flag()); |
319 | 5 | out->set_creation_time(in.creation_time()); |
320 | 5 | if (in.has_tablet_uid()) { |
321 | 2 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
322 | 2 | } |
323 | 5 | out->set_num_segments(in.num_segments()); |
324 | 5 | out->set_rowset_id_v2(in.rowset_id_v2()); |
325 | 5 | out->set_resource_id(in.resource_id()); |
326 | 5 | out->set_newest_write_timestamp(in.newest_write_timestamp()); |
327 | 5 | out->mutable_segments_key_bounds()->Swap(in.mutable_segments_key_bounds()); |
328 | 5 | if (in.has_tablet_schema()) { |
329 | 2 | cloud_tablet_schema_to_doris(out->mutable_tablet_schema(), |
330 | 2 | std::move(*in.mutable_tablet_schema())); |
331 | 2 | } |
332 | 5 | if (in.has_schema_dict_key_list()) { |
333 | 2 | out->mutable_schema_dict_key_list()->Swap(in.mutable_schema_dict_key_list()); |
334 | 2 | } |
335 | 5 | out->set_txn_expiration(in.txn_expiration()); |
336 | 5 | out->set_segments_overlap_pb(in.segments_overlap_pb()); |
337 | 5 | out->set_segments_key_bounds_truncated(in.segments_key_bounds_truncated()); |
338 | 5 | out->mutable_num_segment_rows()->Swap(in.mutable_num_segment_rows()); |
339 | 5 | out->mutable_segments_file_size()->Swap(in.mutable_segments_file_size()); |
340 | 5 | out->set_index_id(in.index_id()); |
341 | 5 | if (in.has_schema_version()) { |
342 | | // See cloud/src/meta-service/meta_service_schema.cpp for details. |
343 | 2 | out->set_schema_version(in.schema_version()); |
344 | 2 | } |
345 | 5 | out->set_enable_segments_file_size(in.enable_segments_file_size()); |
346 | 5 | out->set_has_variant_type_in_schema(in.has_variant_type_in_schema()); |
347 | 5 | out->set_enable_inverted_index_file_info(in.enable_inverted_index_file_info()); |
348 | 5 | out->set_compaction_level(in.compaction_level()); |
349 | 5 | out->mutable_inverted_index_file_info()->Swap(in.mutable_inverted_index_file_info()); |
350 | 5 | out->set_source_rowset_id(in.source_rowset_id()); |
351 | 5 | out->set_source_tablet_id(in.source_tablet_id()); |
352 | 5 | if (in.has___split_schema()) { |
353 | 2 | out->mutable___split_schema()->Swap(in.mutable___split_schema()); |
354 | 2 | } |
355 | 5 | if (in.has_visible_ts_ms()) { |
356 | 2 | out->set_visible_ts_ms(in.visible_ts_ms()); |
357 | 2 | } |
358 | 5 | if (in.has_reference_instance_id()) { |
359 | 2 | out->set_reference_instance_id(in.reference_instance_id()); |
360 | 2 | } |
361 | 5 | auto* slice_locations = out->mutable_packed_slice_locations(); |
362 | 5 | slice_locations->clear(); |
363 | 5 | slice_locations->insert(in.packed_slice_locations().begin(), in.packed_slice_locations().end()); |
364 | 5 | if (in.has_is_recycled()) { |
365 | 2 | out->set_is_recycled(in.is_recycled()); |
366 | 2 | } |
367 | 5 | if (in.has_job_id()) { |
368 | 2 | out->set_job_id(in.job_id()); |
369 | 2 | } |
370 | 5 | if (in.has_commit_tso()) { |
371 | 2 | out->set_commit_tso(in.commit_tso()); |
372 | 2 | } |
373 | 5 | } |
374 | | |
375 | 0 | TabletSchemaCloudPB doris_tablet_schema_to_cloud(const TabletSchemaPB& in) { |
376 | 0 | TabletSchemaCloudPB out; |
377 | 0 | doris_tablet_schema_to_cloud(&out, in); |
378 | 0 | return out; |
379 | 0 | } |
380 | | |
381 | 2 | TabletSchemaCloudPB doris_tablet_schema_to_cloud(TabletSchemaPB&& in) { |
382 | | // ATTN: please keep the set order aligned with the definition of proto. |
383 | 2 | TabletSchemaCloudPB out; |
384 | 2 | doris_tablet_schema_to_cloud(&out, std::move(in)); |
385 | 2 | return out; |
386 | 2 | } |
387 | | |
388 | 3 | void doris_tablet_schema_to_cloud(TabletSchemaCloudPB* out, const TabletSchemaPB& in) { |
389 | | // ATTN: please keep the set order aligned with the definition of proto. |
390 | 3 | out->set_keys_type(in.keys_type()); |
391 | 3 | out->mutable_column()->CopyFrom(in.column()); |
392 | 3 | out->set_num_short_key_columns(in.num_short_key_columns()); |
393 | 3 | out->set_num_rows_per_row_block(in.num_rows_per_row_block()); |
394 | 3 | out->set_compress_kind(in.compress_kind()); |
395 | 3 | out->set_bf_fpp(in.bf_fpp()); |
396 | 3 | out->set_next_column_unique_id(in.next_column_unique_id()); |
397 | 3 | out->set_delete_sign_idx(in.delete_sign_idx()); |
398 | 3 | out->set_sequence_col_idx(in.sequence_col_idx()); |
399 | 3 | out->set_sort_type(in.sort_type()); |
400 | 3 | out->set_sort_col_num(in.sort_col_num()); |
401 | 3 | out->set_compression_type(in.compression_type()); |
402 | 3 | out->set_schema_version(in.schema_version()); |
403 | 3 | out->set_disable_auto_compaction(in.disable_auto_compaction()); |
404 | 3 | out->mutable_index()->CopyFrom(in.index()); |
405 | 3 | out->set_version_col_idx(in.version_col_idx()); |
406 | 3 | out->set_store_row_column(in.store_row_column()); |
407 | 3 | out->set_enable_single_replica_compaction(in.enable_single_replica_compaction()); |
408 | 3 | out->set_skip_write_index_on_load(in.skip_write_index_on_load()); |
409 | 3 | out->mutable_cluster_key_uids()->CopyFrom(in.cluster_key_uids()); |
410 | 3 | out->set_is_dynamic_schema(in.is_dynamic_schema()); |
411 | 3 | out->set_is_external_segment_column_meta_used(in.is_external_segment_column_meta_used()); |
412 | 3 | out->mutable_row_store_column_unique_ids()->CopyFrom(in.row_store_column_unique_ids()); |
413 | 3 | out->set_inverted_index_storage_format(in.inverted_index_storage_format()); |
414 | 3 | out->set_enable_variant_flatten_nested(in.enable_variant_flatten_nested()); |
415 | 3 | out->set_skip_bitmap_col_idx(in.skip_bitmap_col_idx()); |
416 | 3 | out->set_storage_page_size(in.storage_page_size()); |
417 | 3 | out->set_storage_dict_page_size(in.storage_dict_page_size()); |
418 | 3 | out->set_is_in_memory(in.is_in_memory()); |
419 | 3 | out->set_row_store_page_size(in.row_store_page_size()); |
420 | 3 | if (in.has_integer_type_default_use_plain_encoding()) { |
421 | 3 | out->set_integer_type_default_use_plain_encoding( |
422 | 3 | in.integer_type_default_use_plain_encoding()); |
423 | 3 | } |
424 | 3 | if (in.has_binary_plain_encoding_default_impl()) { |
425 | 3 | out->set_binary_plain_encoding_default_impl(in.binary_plain_encoding_default_impl()); |
426 | 3 | } |
427 | 3 | if (in.has_seq_map()) { |
428 | 3 | out->mutable_seq_map()->CopyFrom(in.seq_map()); |
429 | 3 | } |
430 | | |
431 | 3 | if (in.has___split_schema()) { |
432 | 3 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
433 | 3 | } |
434 | 3 | } |
435 | | |
436 | 73.1k | void doris_tablet_schema_to_cloud(TabletSchemaCloudPB* out, TabletSchemaPB&& in) { |
437 | 73.1k | out->set_keys_type(in.keys_type()); |
438 | 73.1k | out->mutable_column()->Swap(in.mutable_column()); |
439 | 73.1k | out->set_num_short_key_columns(in.num_short_key_columns()); |
440 | 73.1k | out->set_num_rows_per_row_block(in.num_rows_per_row_block()); |
441 | 73.1k | out->set_compress_kind(in.compress_kind()); |
442 | 73.1k | out->set_bf_fpp(in.bf_fpp()); |
443 | 73.1k | out->set_next_column_unique_id(in.next_column_unique_id()); |
444 | 73.1k | out->set_delete_sign_idx(in.delete_sign_idx()); |
445 | 73.1k | out->set_sequence_col_idx(in.sequence_col_idx()); |
446 | 73.1k | out->set_sort_type(in.sort_type()); |
447 | 73.1k | out->set_sort_col_num(in.sort_col_num()); |
448 | 73.1k | out->set_compression_type(in.compression_type()); |
449 | 73.1k | out->set_schema_version(in.schema_version()); |
450 | 73.1k | out->set_disable_auto_compaction(in.disable_auto_compaction()); |
451 | 73.1k | out->mutable_index()->Swap(in.mutable_index()); |
452 | 73.1k | out->set_version_col_idx(in.version_col_idx()); |
453 | 73.1k | out->set_store_row_column(in.store_row_column()); |
454 | 73.1k | out->set_enable_single_replica_compaction(in.enable_single_replica_compaction()); |
455 | 73.1k | out->set_skip_write_index_on_load(in.skip_write_index_on_load()); |
456 | 73.1k | out->mutable_cluster_key_uids()->Swap(in.mutable_cluster_key_uids()); |
457 | 73.1k | out->set_is_dynamic_schema(in.is_dynamic_schema()); |
458 | 73.1k | out->set_is_external_segment_column_meta_used(in.is_external_segment_column_meta_used()); |
459 | 73.1k | out->mutable_row_store_column_unique_ids()->Swap(in.mutable_row_store_column_unique_ids()); |
460 | 73.1k | out->set_inverted_index_storage_format(in.inverted_index_storage_format()); |
461 | 73.1k | out->set_enable_variant_flatten_nested(in.enable_variant_flatten_nested()); |
462 | 73.1k | out->set_skip_bitmap_col_idx(in.skip_bitmap_col_idx()); |
463 | 73.1k | out->set_storage_page_size(in.storage_page_size()); |
464 | 73.1k | out->set_storage_dict_page_size(in.storage_dict_page_size()); |
465 | 73.1k | out->set_is_in_memory(in.is_in_memory()); |
466 | 73.1k | out->set_row_store_page_size(in.row_store_page_size()); |
467 | 73.1k | if (in.has_integer_type_default_use_plain_encoding()) { |
468 | 72.9k | out->set_integer_type_default_use_plain_encoding( |
469 | 72.9k | in.integer_type_default_use_plain_encoding()); |
470 | 72.9k | } |
471 | 73.1k | if (in.has_binary_plain_encoding_default_impl()) { |
472 | 72.8k | out->set_binary_plain_encoding_default_impl(in.binary_plain_encoding_default_impl()); |
473 | 72.8k | } |
474 | 73.1k | if (in.has_seq_map()) { |
475 | 72.3k | out->mutable_seq_map()->CopyFrom(in.seq_map()); |
476 | 72.3k | } |
477 | | |
478 | 73.1k | if (in.has___split_schema()) { |
479 | 5 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
480 | 5 | } |
481 | 73.1k | } |
482 | | |
483 | 0 | TabletSchemaPB cloud_tablet_schema_to_doris(const TabletSchemaCloudPB& in) { |
484 | 0 | TabletSchemaPB out; |
485 | 0 | cloud_tablet_schema_to_doris(&out, in); |
486 | 0 | return out; |
487 | 0 | } |
488 | | |
489 | 2 | TabletSchemaPB cloud_tablet_schema_to_doris(TabletSchemaCloudPB&& in) { |
490 | 2 | TabletSchemaPB out; |
491 | 2 | cloud_tablet_schema_to_doris(&out, std::move(in)); |
492 | 2 | return out; |
493 | 2 | } |
494 | | |
495 | 126k | void cloud_tablet_schema_to_doris(TabletSchemaPB* out, const TabletSchemaCloudPB& in) { |
496 | | // ATTN: please keep the set order aligned with the definition of proto. |
497 | 126k | out->set_keys_type(in.keys_type()); |
498 | 126k | out->mutable_column()->CopyFrom(in.column()); |
499 | 126k | out->set_num_short_key_columns(in.num_short_key_columns()); |
500 | 126k | out->set_num_rows_per_row_block(in.num_rows_per_row_block()); |
501 | 126k | out->set_compress_kind(in.compress_kind()); |
502 | 126k | out->set_bf_fpp(in.bf_fpp()); |
503 | 126k | out->set_next_column_unique_id(in.next_column_unique_id()); |
504 | 126k | out->set_delete_sign_idx(in.delete_sign_idx()); |
505 | 126k | out->set_sequence_col_idx(in.sequence_col_idx()); |
506 | 126k | out->set_sort_type(in.sort_type()); |
507 | 126k | out->set_sort_col_num(in.sort_col_num()); |
508 | 126k | out->set_compression_type(in.compression_type()); |
509 | 126k | out->set_schema_version(in.schema_version()); |
510 | 126k | out->set_disable_auto_compaction(in.disable_auto_compaction()); |
511 | 126k | out->mutable_index()->CopyFrom(in.index()); |
512 | 126k | out->set_version_col_idx(in.version_col_idx()); |
513 | 126k | out->set_store_row_column(in.store_row_column()); |
514 | 126k | out->set_enable_single_replica_compaction(in.enable_single_replica_compaction()); |
515 | 126k | out->set_skip_write_index_on_load(in.skip_write_index_on_load()); |
516 | 126k | out->mutable_cluster_key_uids()->CopyFrom(in.cluster_key_uids()); |
517 | 126k | out->set_is_dynamic_schema(in.is_dynamic_schema()); |
518 | 126k | out->set_is_external_segment_column_meta_used(in.is_external_segment_column_meta_used()); |
519 | 126k | out->mutable_row_store_column_unique_ids()->CopyFrom(in.row_store_column_unique_ids()); |
520 | 126k | out->set_inverted_index_storage_format(in.inverted_index_storage_format()); |
521 | 126k | out->set_enable_variant_flatten_nested(in.enable_variant_flatten_nested()); |
522 | 126k | out->set_skip_bitmap_col_idx(in.skip_bitmap_col_idx()); |
523 | 126k | out->set_storage_page_size(in.storage_page_size()); |
524 | 126k | out->set_storage_dict_page_size(in.storage_dict_page_size()); |
525 | 126k | out->set_is_in_memory(in.is_in_memory()); |
526 | 126k | out->set_row_store_page_size(in.row_store_page_size()); |
527 | 126k | if (in.has_integer_type_default_use_plain_encoding()) { |
528 | 51.8k | out->set_integer_type_default_use_plain_encoding( |
529 | 51.8k | in.integer_type_default_use_plain_encoding()); |
530 | 51.8k | } |
531 | 126k | if (in.has_binary_plain_encoding_default_impl()) { |
532 | 51.8k | out->set_binary_plain_encoding_default_impl(in.binary_plain_encoding_default_impl()); |
533 | 51.8k | } |
534 | 126k | if (in.has_seq_map()) { |
535 | 126k | out->mutable_seq_map()->CopyFrom(in.seq_map()); |
536 | 126k | } |
537 | | |
538 | 126k | if (in.has___split_schema()) { |
539 | 3 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
540 | 3 | } |
541 | 126k | } |
542 | | |
543 | 296k | void cloud_tablet_schema_to_doris(TabletSchemaPB* out, TabletSchemaCloudPB&& in) { |
544 | | // ATTN: please keep the set order aligned with the definition of proto. |
545 | 296k | out->set_keys_type(in.keys_type()); |
546 | 296k | out->mutable_column()->Swap(in.mutable_column()); |
547 | 296k | out->set_num_short_key_columns(in.num_short_key_columns()); |
548 | 296k | out->set_num_rows_per_row_block(in.num_rows_per_row_block()); |
549 | 296k | out->set_compress_kind(in.compress_kind()); |
550 | 296k | out->set_bf_fpp(in.bf_fpp()); |
551 | 296k | out->set_next_column_unique_id(in.next_column_unique_id()); |
552 | 296k | out->set_delete_sign_idx(in.delete_sign_idx()); |
553 | 296k | out->set_sequence_col_idx(in.sequence_col_idx()); |
554 | 296k | out->set_sort_type(in.sort_type()); |
555 | 296k | out->set_sort_col_num(in.sort_col_num()); |
556 | 296k | out->set_compression_type(in.compression_type()); |
557 | 296k | out->set_schema_version(in.schema_version()); |
558 | 296k | out->set_disable_auto_compaction(in.disable_auto_compaction()); |
559 | 296k | out->mutable_index()->Swap(in.mutable_index()); |
560 | 296k | out->set_version_col_idx(in.version_col_idx()); |
561 | 296k | out->set_store_row_column(in.store_row_column()); |
562 | 296k | out->set_enable_single_replica_compaction(in.enable_single_replica_compaction()); |
563 | 296k | out->set_skip_write_index_on_load(in.skip_write_index_on_load()); |
564 | 296k | out->mutable_cluster_key_uids()->Swap(in.mutable_cluster_key_uids()); |
565 | 296k | out->set_is_dynamic_schema(in.is_dynamic_schema()); |
566 | 296k | out->set_is_external_segment_column_meta_used(in.is_external_segment_column_meta_used()); |
567 | 296k | out->mutable_row_store_column_unique_ids()->Swap(in.mutable_row_store_column_unique_ids()); |
568 | 296k | out->set_inverted_index_storage_format(in.inverted_index_storage_format()); |
569 | 296k | out->set_enable_variant_flatten_nested(in.enable_variant_flatten_nested()); |
570 | 296k | out->set_skip_bitmap_col_idx(in.skip_bitmap_col_idx()); |
571 | 296k | out->set_storage_page_size(in.storage_page_size()); |
572 | 296k | out->set_storage_dict_page_size(in.storage_dict_page_size()); |
573 | 296k | out->set_is_in_memory(in.is_in_memory()); |
574 | 296k | out->set_row_store_page_size(in.row_store_page_size()); |
575 | 296k | if (in.has_integer_type_default_use_plain_encoding()) { |
576 | 120k | out->set_integer_type_default_use_plain_encoding( |
577 | 120k | in.integer_type_default_use_plain_encoding()); |
578 | 120k | } |
579 | 296k | if (in.has_binary_plain_encoding_default_impl()) { |
580 | 120k | out->set_binary_plain_encoding_default_impl(in.binary_plain_encoding_default_impl()); |
581 | 120k | } |
582 | 296k | if (in.has_seq_map()) { |
583 | 295k | out->mutable_seq_map()->CopyFrom(in.seq_map()); |
584 | 295k | } |
585 | | |
586 | 296k | if (in.has___split_schema()) { |
587 | 5 | out->mutable___split_schema()->CopyFrom(in.__split_schema()); |
588 | 5 | } |
589 | 296k | } |
590 | | |
591 | 0 | TabletMetaCloudPB doris_tablet_meta_to_cloud(const TabletMetaPB& in) { |
592 | 0 | TabletMetaCloudPB out; |
593 | 0 | doris_tablet_meta_to_cloud(&out, in); |
594 | 0 | return out; |
595 | 0 | } |
596 | | |
597 | 1 | TabletMetaCloudPB doris_tablet_meta_to_cloud(TabletMetaPB&& in) { |
598 | 1 | TabletMetaCloudPB out; |
599 | 1 | doris_tablet_meta_to_cloud(&out, std::move(in)); |
600 | 1 | return out; |
601 | 1 | } |
602 | | |
603 | 1 | void doris_tablet_meta_to_cloud(TabletMetaCloudPB* out, const TabletMetaPB& in) { |
604 | | // ATTN: please keep the set order aligned with the definition of proto. |
605 | 1 | out->set_table_id(in.table_id()); |
606 | 1 | out->set_partition_id(in.partition_id()); |
607 | 1 | out->set_tablet_id(in.tablet_id()); |
608 | 1 | out->set_schema_hash(in.schema_hash()); |
609 | 1 | out->set_shard_id(in.shard_id()); |
610 | 1 | out->set_creation_time(in.creation_time()); |
611 | 1 | out->set_cumulative_layer_point(in.cumulative_layer_point()); |
612 | 1 | out->set_tablet_state(in.tablet_state()); |
613 | 1 | if (in.has_schema()) { |
614 | 1 | doris_tablet_schema_to_cloud(out->mutable_schema(), in.schema()); |
615 | 1 | } |
616 | 1 | if (in.rs_metas_size()) { |
617 | 1 | out->mutable_rs_metas()->Reserve(in.rs_metas_size()); |
618 | 1 | for (const auto& rs_meta : in.rs_metas()) { |
619 | 1 | doris_rowset_meta_to_cloud(out->add_rs_metas(), rs_meta); |
620 | 1 | } |
621 | 1 | } |
622 | | // ATTN: inc_rs_metas are deprecated, here is for conversion check |
623 | 1 | if (in.inc_rs_metas_size()) { |
624 | 1 | out->mutable_inc_rs_metas()->Reserve(in.inc_rs_metas_size()); |
625 | 1 | for (const auto& rs_meta : in.inc_rs_metas()) { |
626 | 1 | doris_rowset_meta_to_cloud(out->add_inc_rs_metas(), rs_meta); |
627 | 1 | } |
628 | 1 | } |
629 | 1 | if (in.has_alter_task()) { |
630 | 1 | out->mutable_alter_task()->CopyFrom(in.alter_task()); |
631 | 1 | } |
632 | 1 | out->set_in_restore_mode(in.in_restore_mode()); |
633 | 1 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
634 | 1 | out->set_end_rowset_id(in.end_rowset_id()); |
635 | 1 | out->set_preferred_rowset_type(in.preferred_rowset_type()); |
636 | 1 | out->set_tablet_type(in.tablet_type()); |
637 | 1 | if (in.stale_rs_metas_size()) { |
638 | 1 | out->mutable_stale_rs_metas()->Reserve(in.stale_rs_metas_size()); |
639 | 1 | for (const auto& rs_meta : in.stale_rs_metas()) { |
640 | 1 | doris_rowset_meta_to_cloud(out->add_stale_rs_metas(), rs_meta); |
641 | 1 | } |
642 | 1 | } |
643 | 1 | out->set_replica_id(in.replica_id()); |
644 | 1 | if (in.has_delete_bitmap()) { |
645 | 1 | out->mutable_delete_bitmap()->CopyFrom(in.delete_bitmap()); |
646 | 1 | } |
647 | 1 | out->set_enable_unique_key_merge_on_write(in.enable_unique_key_merge_on_write()); |
648 | 1 | out->set_storage_policy_id(in.storage_policy_id()); |
649 | 1 | out->mutable_cooldown_meta_id()->CopyFrom(in.cooldown_meta_id()); |
650 | 1 | if (in.has_binlog_config()) { |
651 | 1 | out->mutable_binlog_config()->CopyFrom(in.binlog_config()); |
652 | 1 | } |
653 | 1 | out->set_compaction_policy(in.compaction_policy()); |
654 | 1 | out->set_time_series_compaction_goal_size_mbytes(in.time_series_compaction_goal_size_mbytes()); |
655 | 1 | out->set_time_series_compaction_file_count_threshold( |
656 | 1 | in.time_series_compaction_file_count_threshold()); |
657 | 1 | out->set_time_series_compaction_time_threshold_seconds( |
658 | 1 | in.time_series_compaction_time_threshold_seconds()); |
659 | 1 | out->set_time_series_compaction_empty_rowsets_threshold( |
660 | 1 | in.time_series_compaction_empty_rowsets_threshold()); |
661 | 1 | out->set_time_series_compaction_level_threshold(in.time_series_compaction_level_threshold()); |
662 | 1 | out->set_vertical_compaction_num_columns_per_group( |
663 | 1 | in.vertical_compaction_num_columns_per_group()); |
664 | 1 | out->set_index_id(in.index_id()); |
665 | 1 | out->set_is_in_memory(in.is_in_memory()); |
666 | 1 | out->set_is_persistent(in.is_persistent()); |
667 | 1 | out->set_table_name(in.table_name()); |
668 | 1 | out->set_ttl_seconds(in.ttl_seconds()); |
669 | 1 | if (in.has_schema_version()) { |
670 | 1 | out->set_schema_version(in.schema_version()); |
671 | 1 | } |
672 | 1 | if (in.has_encryption_algorithm()) { |
673 | 1 | out->set_encryption_algorithm(in.encryption_algorithm()); |
674 | 1 | } |
675 | 1 | } |
676 | | |
677 | 1 | void doris_tablet_meta_to_cloud(TabletMetaCloudPB* out, TabletMetaPB&& in) { |
678 | | // ATTN: please keep the set order aligned with the definition of proto. |
679 | 1 | out->set_table_id(in.table_id()); |
680 | 1 | out->set_partition_id(in.partition_id()); |
681 | 1 | out->set_tablet_id(in.tablet_id()); |
682 | 1 | out->set_schema_hash(in.schema_hash()); |
683 | 1 | out->set_shard_id(in.shard_id()); |
684 | 1 | out->set_creation_time(in.creation_time()); |
685 | 1 | out->set_cumulative_layer_point(in.cumulative_layer_point()); |
686 | 1 | out->set_tablet_state(in.tablet_state()); |
687 | 1 | if (in.has_schema()) { |
688 | 1 | doris_tablet_schema_to_cloud(out->mutable_schema(), std::move(*in.mutable_schema())); |
689 | 1 | } |
690 | 1 | if (in.rs_metas_size()) { |
691 | 1 | int32_t rs_metas_size = in.rs_metas_size(); |
692 | 1 | out->mutable_rs_metas()->Reserve(rs_metas_size); |
693 | 2 | for (int i = 0; i < rs_metas_size; ++i) { |
694 | 1 | doris_rowset_meta_to_cloud(out->add_rs_metas(), std::move(*in.mutable_rs_metas(i))); |
695 | 1 | } |
696 | 1 | } |
697 | | // ATTN: inc_rs_metas are deprecated, here is for conversion check |
698 | 1 | if (in.inc_rs_metas_size()) { |
699 | 1 | int rs_metas_size = in.inc_rs_metas_size(); |
700 | 1 | out->mutable_inc_rs_metas()->Reserve(rs_metas_size); |
701 | 2 | for (int i = 0; i < rs_metas_size; ++i) { |
702 | 1 | doris_rowset_meta_to_cloud(out->add_inc_rs_metas(), |
703 | 1 | std::move(*in.mutable_inc_rs_metas(i))); |
704 | 1 | } |
705 | 1 | } |
706 | 1 | if (in.has_alter_task()) { |
707 | 1 | out->mutable_alter_task()->Swap(in.mutable_alter_task()); |
708 | 1 | } |
709 | 1 | out->set_in_restore_mode(in.in_restore_mode()); |
710 | 1 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
711 | 1 | out->set_end_rowset_id(in.end_rowset_id()); |
712 | 1 | out->set_preferred_rowset_type(in.preferred_rowset_type()); |
713 | 1 | out->set_tablet_type(in.tablet_type()); |
714 | 1 | if (in.stale_rs_metas_size()) { |
715 | 1 | int rs_metas_size = in.stale_rs_metas_size(); |
716 | 1 | out->mutable_stale_rs_metas()->Reserve(rs_metas_size); |
717 | 2 | for (int i = 0; i < rs_metas_size; i++) { |
718 | 1 | doris_rowset_meta_to_cloud(out->add_stale_rs_metas(), |
719 | 1 | std::move(*in.mutable_stale_rs_metas(i))); |
720 | 1 | } |
721 | 1 | } |
722 | 1 | out->set_replica_id(in.replica_id()); |
723 | 1 | if (in.has_delete_bitmap()) { |
724 | 1 | out->mutable_delete_bitmap()->Swap(in.mutable_delete_bitmap()); |
725 | 1 | } |
726 | 1 | out->set_enable_unique_key_merge_on_write(in.enable_unique_key_merge_on_write()); |
727 | 1 | out->set_storage_policy_id(in.storage_policy_id()); |
728 | 1 | out->mutable_cooldown_meta_id()->CopyFrom(in.cooldown_meta_id()); |
729 | 1 | if (in.has_binlog_config()) { |
730 | 1 | out->mutable_binlog_config()->Swap(in.mutable_binlog_config()); |
731 | 1 | } |
732 | 1 | out->set_compaction_policy(in.compaction_policy()); |
733 | 1 | out->set_time_series_compaction_goal_size_mbytes(in.time_series_compaction_goal_size_mbytes()); |
734 | 1 | out->set_time_series_compaction_file_count_threshold( |
735 | 1 | in.time_series_compaction_file_count_threshold()); |
736 | 1 | out->set_time_series_compaction_time_threshold_seconds( |
737 | 1 | in.time_series_compaction_time_threshold_seconds()); |
738 | 1 | out->set_time_series_compaction_empty_rowsets_threshold( |
739 | 1 | in.time_series_compaction_empty_rowsets_threshold()); |
740 | 1 | out->set_time_series_compaction_level_threshold(in.time_series_compaction_level_threshold()); |
741 | 1 | out->set_vertical_compaction_num_columns_per_group( |
742 | 1 | in.vertical_compaction_num_columns_per_group()); |
743 | 1 | out->set_index_id(in.index_id()); |
744 | 1 | out->set_is_in_memory(in.is_in_memory()); |
745 | 1 | out->set_is_persistent(in.is_persistent()); |
746 | 1 | out->set_table_name(in.table_name()); |
747 | 1 | out->set_ttl_seconds(in.ttl_seconds()); |
748 | 1 | if (in.has_schema_version()) { |
749 | 1 | out->set_schema_version(in.schema_version()); |
750 | 1 | } |
751 | 1 | if (in.has_encryption_algorithm()) { |
752 | 1 | out->set_encryption_algorithm(in.encryption_algorithm()); |
753 | 1 | } |
754 | 1 | } |
755 | | |
756 | 0 | TabletMetaPB cloud_tablet_meta_to_doris(const TabletMetaCloudPB& in) { |
757 | 0 | TabletMetaPB out; |
758 | 0 | cloud_tablet_meta_to_doris(&out, in); |
759 | 0 | return out; |
760 | 0 | } |
761 | | |
762 | 296k | TabletMetaPB cloud_tablet_meta_to_doris(TabletMetaCloudPB&& in) { |
763 | 296k | TabletMetaPB out; |
764 | 296k | cloud_tablet_meta_to_doris(&out, std::move(in)); |
765 | 296k | return out; |
766 | 296k | } |
767 | | |
768 | 1 | void cloud_tablet_meta_to_doris(TabletMetaPB* out, const TabletMetaCloudPB& in) { |
769 | | // ATTN: please keep the set order aligned with the definition of proto. |
770 | 1 | out->set_table_id(in.table_id()); |
771 | 1 | out->set_partition_id(in.partition_id()); |
772 | 1 | out->set_tablet_id(in.tablet_id()); |
773 | 1 | out->set_schema_hash(in.schema_hash()); |
774 | 1 | out->set_shard_id(in.shard_id()); |
775 | 1 | out->set_creation_time(in.creation_time()); |
776 | 1 | out->set_cumulative_layer_point(in.cumulative_layer_point()); |
777 | 1 | out->set_tablet_state(in.tablet_state()); |
778 | 1 | if (in.has_schema()) { |
779 | 1 | cloud_tablet_schema_to_doris(out->mutable_schema(), in.schema()); |
780 | 1 | } |
781 | 1 | if (in.rs_metas_size()) { |
782 | 1 | out->mutable_rs_metas()->Reserve(in.rs_metas_size()); |
783 | 1 | for (const auto& rs_meta : in.rs_metas()) { |
784 | 1 | cloud_rowset_meta_to_doris(out->add_rs_metas(), rs_meta); |
785 | 1 | } |
786 | 1 | } |
787 | | // ATTN: inc_rs_metas are deprecated, here is for conversion check |
788 | 1 | if (in.inc_rs_metas_size()) { |
789 | 1 | out->mutable_inc_rs_metas()->Reserve(in.inc_rs_metas_size()); |
790 | 1 | for (const auto& rs_meta : in.inc_rs_metas()) { |
791 | 1 | cloud_rowset_meta_to_doris(out->add_inc_rs_metas(), rs_meta); |
792 | 1 | } |
793 | 1 | } |
794 | 1 | if (in.has_alter_task()) { |
795 | 1 | out->mutable_alter_task()->CopyFrom(in.alter_task()); |
796 | 1 | } |
797 | 1 | out->set_in_restore_mode(in.in_restore_mode()); |
798 | 1 | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
799 | 1 | out->set_end_rowset_id(in.end_rowset_id()); |
800 | 1 | out->set_preferred_rowset_type(in.preferred_rowset_type()); |
801 | 1 | out->set_tablet_type(in.tablet_type()); |
802 | 1 | if (in.stale_rs_metas_size()) { |
803 | 1 | out->mutable_stale_rs_metas()->Reserve(in.stale_rs_metas_size()); |
804 | 1 | for (const auto& rs_meta : in.stale_rs_metas()) { |
805 | 1 | cloud_rowset_meta_to_doris(out->add_stale_rs_metas(), rs_meta); |
806 | 1 | } |
807 | 1 | } |
808 | 1 | out->set_replica_id(in.replica_id()); |
809 | 1 | if (in.has_delete_bitmap()) { |
810 | 1 | out->mutable_delete_bitmap()->CopyFrom(in.delete_bitmap()); |
811 | 1 | } |
812 | 1 | out->set_enable_unique_key_merge_on_write(in.enable_unique_key_merge_on_write()); |
813 | 1 | out->set_storage_policy_id(in.storage_policy_id()); |
814 | 1 | out->mutable_cooldown_meta_id()->CopyFrom(in.cooldown_meta_id()); |
815 | 1 | if (in.has_binlog_config()) { |
816 | 1 | out->mutable_binlog_config()->CopyFrom(in.binlog_config()); |
817 | 1 | } |
818 | 1 | out->set_compaction_policy(in.compaction_policy()); |
819 | 1 | out->set_time_series_compaction_goal_size_mbytes(in.time_series_compaction_goal_size_mbytes()); |
820 | 1 | out->set_time_series_compaction_file_count_threshold( |
821 | 1 | in.time_series_compaction_file_count_threshold()); |
822 | 1 | out->set_time_series_compaction_time_threshold_seconds( |
823 | 1 | in.time_series_compaction_time_threshold_seconds()); |
824 | 1 | out->set_time_series_compaction_empty_rowsets_threshold( |
825 | 1 | in.time_series_compaction_empty_rowsets_threshold()); |
826 | 1 | out->set_time_series_compaction_level_threshold(in.time_series_compaction_level_threshold()); |
827 | 1 | out->set_vertical_compaction_num_columns_per_group( |
828 | 1 | in.vertical_compaction_num_columns_per_group()); |
829 | 1 | out->set_index_id(in.index_id()); |
830 | 1 | out->set_is_in_memory(in.is_in_memory()); |
831 | 1 | out->set_is_persistent(in.is_persistent()); |
832 | 1 | out->set_table_name(in.table_name()); |
833 | 1 | out->set_ttl_seconds(in.ttl_seconds()); |
834 | 1 | if (in.has_schema_version()) { |
835 | 1 | out->set_schema_version(in.schema_version()); |
836 | 1 | } |
837 | 1 | if (in.has_encryption_algorithm()) { |
838 | 1 | out->set_encryption_algorithm(in.encryption_algorithm()); |
839 | 1 | } |
840 | 1 | } |
841 | | |
842 | 296k | void cloud_tablet_meta_to_doris(TabletMetaPB* out, TabletMetaCloudPB&& in) { |
843 | | // ATTN: please keep the set order aligned with the definition of proto. |
844 | 296k | out->set_table_id(in.table_id()); |
845 | 296k | out->set_partition_id(in.partition_id()); |
846 | 296k | out->set_tablet_id(in.tablet_id()); |
847 | 296k | out->set_schema_hash(in.schema_hash()); |
848 | 296k | out->set_shard_id(in.shard_id()); |
849 | 296k | out->set_creation_time(in.creation_time()); |
850 | 296k | out->set_cumulative_layer_point(in.cumulative_layer_point()); |
851 | 296k | out->set_tablet_state(in.tablet_state()); |
852 | 296k | if (in.has_schema()) { |
853 | 295k | cloud_tablet_schema_to_doris(out->mutable_schema(), std::move(*in.mutable_schema())); |
854 | 295k | } |
855 | 296k | if (in.rs_metas_size()) { |
856 | 1 | int rs_metas_size = in.rs_metas_size(); |
857 | 1 | out->mutable_rs_metas()->Reserve(rs_metas_size); |
858 | 2 | for (int i = 0; i < rs_metas_size; ++i) { |
859 | 1 | cloud_rowset_meta_to_doris(out->add_rs_metas(), std::move(*in.mutable_rs_metas(i))); |
860 | 1 | } |
861 | 1 | } |
862 | | // ATTN: inc_rs_metas are deprecated, here is for conversion check |
863 | 296k | if (in.inc_rs_metas_size()) { |
864 | 1 | int rs_metas_size = in.inc_rs_metas_size(); |
865 | 1 | out->mutable_inc_rs_metas()->Reserve(rs_metas_size); |
866 | 2 | for (int i = 0; i < rs_metas_size; i++) { |
867 | 1 | cloud_rowset_meta_to_doris(out->add_inc_rs_metas(), |
868 | 1 | std::move(*in.mutable_inc_rs_metas(i))); |
869 | 1 | } |
870 | 1 | } |
871 | 296k | if (in.has_alter_task()) { |
872 | 1 | out->mutable_alter_task()->Swap(in.mutable_alter_task()); |
873 | 1 | } |
874 | 296k | out->set_in_restore_mode(in.in_restore_mode()); |
875 | 296k | out->mutable_tablet_uid()->CopyFrom(in.tablet_uid()); |
876 | 296k | out->set_end_rowset_id(in.end_rowset_id()); |
877 | 296k | out->set_preferred_rowset_type(in.preferred_rowset_type()); |
878 | 296k | out->set_tablet_type(in.tablet_type()); |
879 | 296k | if (in.stale_rs_metas_size()) { |
880 | 1 | int rs_metas_size = in.stale_rs_metas_size(); |
881 | 1 | out->mutable_stale_rs_metas()->Reserve(rs_metas_size); |
882 | 2 | for (int i = 0; i < rs_metas_size; i++) { |
883 | 1 | cloud_rowset_meta_to_doris(out->add_stale_rs_metas(), |
884 | 1 | std::move(*in.mutable_stale_rs_metas(i))); |
885 | 1 | } |
886 | 1 | } |
887 | 296k | out->set_replica_id(in.replica_id()); |
888 | 296k | if (in.has_delete_bitmap()) { |
889 | 1 | out->mutable_delete_bitmap()->Swap(in.mutable_delete_bitmap()); |
890 | 1 | } |
891 | 296k | out->set_enable_unique_key_merge_on_write(in.enable_unique_key_merge_on_write()); |
892 | 296k | out->set_storage_policy_id(in.storage_policy_id()); |
893 | 296k | out->mutable_cooldown_meta_id()->CopyFrom(in.cooldown_meta_id()); |
894 | 296k | if (in.has_binlog_config()) { |
895 | 1 | out->mutable_binlog_config()->Swap(in.mutable_binlog_config()); |
896 | 1 | } |
897 | 296k | out->set_compaction_policy(in.compaction_policy()); |
898 | 296k | out->set_time_series_compaction_goal_size_mbytes(in.time_series_compaction_goal_size_mbytes()); |
899 | 296k | out->set_time_series_compaction_file_count_threshold( |
900 | 296k | in.time_series_compaction_file_count_threshold()); |
901 | 296k | out->set_time_series_compaction_time_threshold_seconds( |
902 | 296k | in.time_series_compaction_time_threshold_seconds()); |
903 | 296k | out->set_time_series_compaction_empty_rowsets_threshold( |
904 | 296k | in.time_series_compaction_empty_rowsets_threshold()); |
905 | 296k | out->set_time_series_compaction_level_threshold(in.time_series_compaction_level_threshold()); |
906 | 296k | out->set_vertical_compaction_num_columns_per_group( |
907 | 296k | in.vertical_compaction_num_columns_per_group()); |
908 | 296k | out->set_index_id(in.index_id()); |
909 | 296k | out->set_is_in_memory(in.is_in_memory()); |
910 | 296k | out->set_is_persistent(in.is_persistent()); |
911 | 296k | out->set_table_name(in.table_name()); |
912 | 296k | out->set_ttl_seconds(in.ttl_seconds()); |
913 | 296k | if (in.has_schema_version()) { |
914 | 296k | out->set_schema_version(in.schema_version()); |
915 | 296k | } |
916 | 296k | if (in.has_encryption_algorithm()) { |
917 | 296k | out->set_encryption_algorithm(in.encryption_algorithm()); |
918 | 296k | } |
919 | 296k | } |
920 | | |
921 | | } // namespace doris::cloud |