be/src/format/table/iceberg_scan_semantics.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 "gen_cpp/PlanNodes_types.h" |
21 | | |
22 | | namespace doris { |
23 | | |
24 | | inline constexpr int32_t ICEBERG_SCAN_SEMANTICS_VERSION_1 = 1; |
25 | | inline constexpr int32_t ICEBERG_SCAN_SEMANTICS_VERSION_2 = 2; |
26 | | |
27 | 697 | inline bool supports_iceberg_scan_semantics_v1(const TFileScanRangeParams* params) { |
28 | | // Old FE plans can carry IDs and encoded defaults too, so only this explicit version marker |
29 | | // may opt a new BE into result-changing semantics during a rolling upgrade. |
30 | 697 | return params != nullptr && params->__isset.iceberg_scan_semantics_version && |
31 | 697 | params->iceberg_scan_semantics_version >= ICEBERG_SCAN_SEMANTICS_VERSION_1; |
32 | 697 | } |
33 | | |
34 | 246 | inline bool supports_iceberg_scan_semantics_v2(const TFileScanRangeParams* params) { |
35 | 246 | return params != nullptr && params->__isset.iceberg_scan_semantics_version && |
36 | 246 | params->iceberg_scan_semantics_version >= ICEBERG_SCAN_SEMANTICS_VERSION_2; |
37 | 246 | } |
38 | | |
39 | | // Iceberg manifest-entry content codes (spec: 1 = position deletes, 3 = deletion vectors). |
40 | | inline constexpr int kIcebergPositionDeleteContent = 1; |
41 | | inline constexpr int kIcebergDeletionVectorContent = 3; |
42 | | |
43 | 1 | inline bool is_iceberg_position_deletes_sys_table(const TFileRangeDesc& range) { |
44 | 1 | return range.__isset.table_format_params && |
45 | 1 | range.table_format_params.table_format_type == "iceberg" && |
46 | 1 | range.table_format_params.__isset.iceberg_params && |
47 | 1 | range.table_format_params.iceberg_params.__isset.content && |
48 | 1 | (range.table_format_params.iceberg_params.content == kIcebergPositionDeleteContent || |
49 | 0 | range.table_format_params.iceberg_params.content == kIcebergDeletionVectorContent); |
50 | 1 | } |
51 | | |
52 | | } // namespace doris |