Coverage Report

Created: 2026-08-02 08:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exec/scan/access_path_parser.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 "exec/scan/access_path_parser.h"
19
20
#include <fmt/format.h>
21
22
#include <algorithm>
23
#include <charconv>
24
#include <map>
25
#include <string>
26
#include <string_view>
27
#include <utility>
28
29
#include "common/cast_set.h"
30
#include "common/consts.h"
31
#include "core/assert_cast.h"
32
#include "core/data_type/data_type.h"
33
#include "core/data_type/data_type_array.h"
34
#include "core/data_type/data_type_map.h"
35
#include "core/data_type/data_type_nullable.h"
36
#include "core/data_type/data_type_struct.h"
37
#include "runtime/descriptors.h"
38
#include "util/string_util.h"
39
40
namespace doris {
41
namespace {
42
43
293k
bool is_scanner_materialized_virtual_column(const std::string& column_name) {
44
293k
    return column_name == BeConsts::ICEBERG_ROWID_COL;
45
293k
}
46
47
48.8k
bool parse_non_negative_int(std::string_view value, int32_t* result) {
48
48.8k
    DORIS_CHECK(result != nullptr);
49
48.8k
    int32_t parsed = -1;
50
48.8k
    const auto* begin = value.data();
51
48.8k
    const auto* end = begin + value.size();
52
48.8k
    const auto [ptr, ec] = std::from_chars(begin, end, parsed);
53
48.8k
    if (ec != std::errc() || ptr != end || parsed < 0) {
54
24.1k
        return false;
55
24.1k
    }
56
24.6k
    *result = parsed;
57
24.6k
    return true;
58
48.8k
}
59
60
2
std::string access_path_to_string(const std::vector<std::string>& path) {
61
2
    return fmt::format("{}", fmt::join(path, "."));
62
2
}
63
64
format::ColumnDefinition* find_or_add_child(format::ColumnDefinition* parent, int32_t id,
65
197k
                                            std::string name, DataTypePtr type) {
66
197k
    DORIS_CHECK(parent != nullptr);
67
197k
    for (auto& child : parent->children) {
68
97.9k
        if ((child.has_identifier_field_id() && child.get_identifier_field_id() == id) ||
69
97.9k
            child.name == name) {
70
0
            return &child;
71
0
        }
72
97.9k
    }
73
197k
    parent->children.push_back({
74
197k
            .identifier = Field::create_field<TYPE_INT>(id),
75
197k
            .name = std::move(name),
76
197k
            .type = std::move(type),
77
197k
            .children = {},
78
197k
            .default_expr = nullptr,
79
197k
            .is_partition_key = false,
80
197k
    });
81
197k
    return &parent->children.back();
82
197k
}
83
84
void inherit_schema_metadata(format::ColumnDefinition* column,
85
197k
                             const format::ColumnDefinition* schema_column) {
86
197k
    if (column == nullptr || schema_column == nullptr) {
87
130k
        return;
88
130k
    }
89
66.3k
    column->name_mapping = schema_column->name_mapping;
90
    // The presence bit is part of the mapping contract: an explicit empty mapping must remain
91
    // authoritative after access-path pruning instead of enabling current-name fallback.
92
66.3k
    column->has_name_mapping = schema_column->has_name_mapping;
93
66.3k
    column->initial_default_value = schema_column->initial_default_value;
94
66.3k
    column->initial_default_value_is_base64 = schema_column->initial_default_value_is_base64;
95
66.3k
    column->is_optional = schema_column->is_optional;
96
66.3k
    column->default_expr = schema_column->default_expr;
97
66.3k
}
98
99
const format::ColumnDefinition* find_schema_child_by_path(
100
        const format::ColumnDefinition* schema_column, const std::string& child_path,
101
56.9k
        bool prefer_exact_name_match) {
102
56.9k
    if (schema_column == nullptr) {
103
30.1k
        return nullptr;
104
30.1k
    }
105
26.8k
    int32_t parsed_field_id = -1;
106
26.8k
    if (parse_non_negative_int(child_path, &parsed_field_id)) {
107
2.61k
        const auto child_it = std::ranges::find_if(
108
3.70k
                schema_column->children, [&](const format::ColumnDefinition& child) {
109
3.70k
                    return child.has_identifier_field_id() &&
110
3.70k
                           child.get_identifier_field_id() == parsed_field_id;
111
3.70k
                });
112
2.61k
        return child_it == schema_column->children.end() ? nullptr : &*child_it;
113
2.61k
    }
114
24.1k
    if (!prefer_exact_name_match) {
115
14.9k
        const auto child_it = std::ranges::find_if(schema_column->children, [&](const auto& child) {
116
14.9k
            if (to_lower(child.name) == to_lower(child_path)) {
117
7.32k
                return true;
118
7.32k
            }
119
7.64k
            return std::ranges::any_of(child.name_mapping, [&](const std::string& alias) {
120
1
                return to_lower(alias) == to_lower(child_path);
121
1
            });
122
14.9k
        });
123
7.32k
        return child_it == schema_column->children.end() ? nullptr : &*child_it;
124
7.32k
    }
125
    // Iceberg can reuse a historical name for a newly added sibling. Current names therefore
126
    // have precedence across the entire struct; an earlier alias must not steal that access path.
127
29.7k
    const auto exact_it = std::ranges::find_if(schema_column->children, [&](const auto& child) {
128
29.7k
        return to_lower(child.name) == to_lower(child_path);
129
29.7k
    });
130
16.8k
    if (exact_it != schema_column->children.end()) {
131
16.8k
        return &*exact_it;
132
16.8k
    }
133
11
    const auto alias_it = std::ranges::find_if(schema_column->children, [&](const auto& child) {
134
11
        return std::ranges::any_of(child.name_mapping, [&](const std::string& alias) {
135
6
            return to_lower(alias) == to_lower(child_path);
136
6
        });
137
11
    });
138
6
    return alias_it == schema_column->children.end() ? nullptr : &*alias_it;
139
16.8k
}
140
141
197k
int32_t schema_field_id(const format::ColumnDefinition* schema_column) {
142
197k
    if (schema_column == nullptr || !schema_column->has_identifier_field_id()) {
143
144k
        return -1;
144
144k
    }
145
52.4k
    return schema_column->get_identifier_field_id();
146
197k
}
147
148
194k
int32_t schema_field_id_or(const format::ColumnDefinition* schema_column, int32_t fallback) {
149
194k
    const auto field_id = schema_field_id(schema_column);
150
194k
    return field_id >= 0 ? field_id : fallback;
151
194k
}
152
153
std::string schema_field_name_or(const format::ColumnDefinition* schema_column,
154
54.2k
                                 std::string fallback) {
155
54.2k
    return schema_column == nullptr || schema_column->name.empty() ? fallback : schema_column->name;
156
54.2k
}
157
158
struct AccessPathNode {
159
    bool project_all = false;
160
    std::map<std::string, AccessPathNode> children;
161
};
162
163
1.10k
void merge_access_path_node(AccessPathNode* dst, const AccessPathNode& src) {
164
1.10k
    DORIS_CHECK(dst != nullptr);
165
1.10k
    if (dst->project_all) {
166
0
        return;
167
0
    }
168
1.10k
    if (src.project_all) {
169
665
        dst->project_all = true;
170
665
        dst->children.clear();
171
665
        return;
172
665
    }
173
566
    for (const auto& [path, child] : src.children) {
174
566
        merge_access_path_node(&dst->children[path], child);
175
566
    }
176
438
}
177
178
void insert_access_path(AccessPathNode* root, const std::vector<std::string>& path,
179
27.5k
                        size_t path_idx) {
180
27.5k
    DORIS_CHECK(root != nullptr);
181
27.5k
    if (root->project_all) {
182
0
        return;
183
0
    }
184
27.5k
    if (path_idx >= path.size()) {
185
23.8k
        root->project_all = true;
186
23.8k
        root->children.clear();
187
23.8k
        return;
188
23.8k
    }
189
3.72k
    insert_access_path(&root->children[path[path_idx]], path, path_idx + 1);
190
3.72k
}
191
192
Status build_nested_children_from_access_node(format::ColumnDefinition* column,
193
                                              const DataTypePtr& type, const AccessPathNode& node,
194
                                              const std::string& path,
195
                                              const format::ColumnDefinition* schema_column,
196
                                              bool prefer_exact_name_match);
197
198
// Expand a full complex-column projection into table-schema children when the table format provides
199
// an external/current schema. Without this, `SELECT complex_col` or `SELECT *` leaves
200
// ColumnDefinition::children empty, so ColumnMapper treats the root complex column as a scalar
201
// mapping and later tries to cast the old file shape to the current table shape directly.
202
//
203
// Examples:
204
//   - STRUCT country/city projected from an old file STRUCT country/population/location should
205
//     create children country and city, so city can be materialized as missing/default.
206
//   - ARRAY<STRUCT<item, quantity>> should create the array element wrapper and then the element
207
//     struct children item and quantity.
208
//   - MAP<STRING, STRUCT<full_name, age>> should create semantic children key/value directly, then
209
//     expand the value struct children full_name and age. Do not introduce a physical entries
210
//     wrapper here: ColumnMapper and TableReader treat MAP children as [key, value].
211
Status build_all_nested_children_from_schema(format::ColumnDefinition* column,
212
                                             const DataTypePtr& type, const std::string& path,
213
                                             const format::ColumnDefinition* schema_column,
214
296k
                                             bool prefer_exact_name_match) {
215
296k
    DORIS_CHECK(column != nullptr);
216
217
296k
    const auto nested_type = remove_nullable(type);
218
296k
    AccessPathNode project_all;
219
296k
    project_all.project_all = true;
220
296k
    switch (nested_type->get_primitive_type()) {
221
25.2k
    case TYPE_STRUCT: {
222
25.2k
        const auto& struct_type = assert_cast<const DataTypeStruct&>(*nested_type);
223
79.5k
        for (size_t field_idx = 0; field_idx < struct_type.get_elements().size(); ++field_idx) {
224
54.2k
            const auto field_name = struct_type.get_element_name(field_idx);
225
54.2k
            const auto* schema_child =
226
54.2k
                    find_schema_child_by_path(schema_column, field_name, prefer_exact_name_match);
227
54.2k
            auto* child = find_or_add_child(
228
54.2k
                    column, schema_field_id_or(schema_child, cast_set<int32_t>(field_idx)),
229
54.2k
                    schema_field_name_or(schema_child, field_name),
230
54.2k
                    struct_type.get_element(field_idx));
231
54.2k
            inherit_schema_metadata(child, schema_child);
232
54.2k
            RETURN_IF_ERROR(build_nested_children_from_access_node(
233
54.2k
                    child, child->type, project_all, path + "." + child->name, schema_child,
234
54.2k
                    prefer_exact_name_match));
235
54.2k
        }
236
25.2k
        return Status::OK();
237
25.2k
    }
238
49.3k
    case TYPE_ARRAY: {
239
49.3k
        const auto& array_type = assert_cast<const DataTypeArray&>(*nested_type);
240
49.3k
        const auto* element_schema = schema_column != nullptr && !schema_column->children.empty()
241
49.3k
                                             ? schema_column->children.data()
242
49.3k
                                             : nullptr;
243
49.3k
        auto* child = find_or_add_child(column, schema_field_id_or(element_schema, 0), "element",
244
49.3k
                                        array_type.get_nested_type());
245
49.3k
        inherit_schema_metadata(child, element_schema);
246
49.3k
        return build_nested_children_from_access_node(child, child->type, project_all, path + ".*",
247
49.3k
                                                      element_schema, prefer_exact_name_match);
248
25.2k
    }
249
44.9k
    case TYPE_MAP: {
250
44.9k
        const auto& map_type = assert_cast<const DataTypeMap&>(*nested_type);
251
44.9k
        const auto* key_schema = schema_column != nullptr && !schema_column->children.empty()
252
44.9k
                                         ? schema_column->children.data()
253
44.9k
                                         : nullptr;
254
44.9k
        const auto* value_schema = schema_column != nullptr && schema_column->children.size() > 1
255
44.9k
                                           ? &schema_column->children[1]
256
44.9k
                                           : nullptr;
257
44.9k
        auto* key_child = find_or_add_child(column, schema_field_id_or(key_schema, 0), "key",
258
44.9k
                                            map_type.get_key_type());
259
44.9k
        inherit_schema_metadata(key_child, key_schema);
260
44.9k
        RETURN_IF_ERROR(build_nested_children_from_access_node(
261
44.9k
                key_child, key_child->type, project_all, path + ".KEYS", key_schema,
262
44.9k
                prefer_exact_name_match));
263
44.9k
        auto* value_child = find_or_add_child(column, schema_field_id_or(value_schema, 1), "value",
264
44.9k
                                              map_type.get_value_type());
265
44.9k
        inherit_schema_metadata(value_child, value_schema);
266
44.9k
        RETURN_IF_ERROR(build_nested_children_from_access_node(
267
44.9k
                value_child, value_child->type, project_all, path + ".VALUES", value_schema,
268
44.9k
                prefer_exact_name_match));
269
44.9k
        return Status::OK();
270
44.9k
    }
271
177k
    default:
272
177k
        return Status::OK();
273
296k
    }
274
296k
}
275
276
Status build_struct_children_from_access_node(format::ColumnDefinition* column,
277
                                              const DataTypeStruct& struct_type,
278
                                              const AccessPathNode& node, const std::string& path,
279
                                              const format::ColumnDefinition* schema_column,
280
1.98k
                                              bool prefer_exact_name_match) {
281
1.98k
    DORIS_CHECK(column != nullptr);
282
2.65k
    for (const auto& [child_path, child_node] : node.children) {
283
        // Struct children are resolved by name or schema field id. We do not treat a numeric
284
        // child token as a struct ordinal, because `col.0` becomes ambiguous once the struct
285
        // evolves. Position-based access needs a separate design if it is required later.
286
2.65k
        if (child_path == "OFFSET" || child_path == "*" || child_path == "KEYS" ||
287
2.65k
            child_path == "VALUES") {
288
4
            return Status::NotSupported(
289
4
                    "AccessPathParser does not support access path {} for slot {}",
290
4
                    path + "." + child_path, column->name);
291
4
        }
292
293
        // Prefer the table/schema ColumnDefinition because it carries field ids and aliases.
294
        // Fallback to the struct type name only for formats without external schema metadata.
295
2.65k
        const auto* schema_child =
296
2.65k
                find_schema_child_by_path(schema_column, child_path, prefer_exact_name_match);
297
2.65k
        int32_t field_id = schema_field_id(schema_child);
298
2.65k
        std::string field_name = schema_child == nullptr ? child_path : schema_child->name;
299
2.65k
        DataTypePtr field_type = schema_child == nullptr ? nullptr : schema_child->type;
300
2.65k
        if (field_id < 0 || field_type == nullptr) {
301
39
            for (size_t field_idx = 0; field_idx < struct_type.get_elements().size(); ++field_idx) {
302
36
                if (to_lower(struct_type.get_element_name(field_idx)) == to_lower(field_name)) {
303
21
                    field_id = cast_set<int32_t>(field_idx);
304
21
                    field_name = struct_type.get_element_name(field_idx);
305
21
                    field_type = struct_type.get_element(field_idx);
306
21
                    break;
307
21
                }
308
36
            }
309
24
        }
310
311
2.65k
        if (field_id < 0 || field_type == nullptr) {
312
3
            return Status::NotSupported(
313
3
                    "AccessPathParser does not support access path {} for slot {}",
314
3
                    path + "." + child_path, column->name);
315
3
        }
316
        // TODO: For TVF Parquet files without field ids, this fallback uses the struct ordinal as
317
        // the table child identifier. BY_NAME mapping should instead keep a string identifier and
318
        // let TableColumnMapper resolve the file-local child id from the Parquet schema.
319
2.64k
        auto* child = find_or_add_child(column, field_id, field_name, field_type);
320
2.64k
        inherit_schema_metadata(child, schema_child);
321
2.64k
        RETURN_IF_ERROR(build_nested_children_from_access_node(
322
2.64k
                child, child->type, child_node, path + "." + child_path, schema_child,
323
2.64k
                prefer_exact_name_match));
324
2.64k
    }
325
1.98k
    return Status::OK();
326
1.98k
}
327
328
Status build_map_children_from_access_node(format::ColumnDefinition* column,
329
                                           const DataTypeMap& map_type, const AccessPathNode& node,
330
                                           const std::string& path,
331
                                           const format::ColumnDefinition* schema_column,
332
474
                                           bool prefer_exact_name_match) {
333
474
    DORIS_CHECK(column != nullptr);
334
474
    AccessPathNode key_node;
335
474
    AccessPathNode value_node;
336
474
    bool need_key = false;
337
474
    bool need_value = false;
338
339
539
    for (const auto& [child_path, child_node] : node.children) {
340
539
        if (child_path == "OFFSET") {
341
1
            return Status::NotSupported(
342
1
                    "AccessPathParser does not support access path {} for slot {}",
343
1
                    path + "." + child_path, column->name);
344
1
        }
345
538
        if (child_path == "KEYS") {
346
81
            need_key = true;
347
81
            merge_access_path_node(&key_node, child_node);
348
81
            continue;
349
81
        }
350
457
        if (child_path == "VALUES" || child_path == "*") {
351
456
            need_key = true;
352
456
            key_node.project_all = true;
353
456
            key_node.children.clear();
354
456
            need_value = true;
355
456
            merge_access_path_node(&value_node, child_node);
356
456
            continue;
357
456
        }
358
1
        return Status::NotSupported("AccessPathParser does not support access path {} for slot {}",
359
1
                                    path + "." + child_path, column->name);
360
457
    }
361
472
    if (need_key && !need_value) {
362
        // A key-only MAP projection is not independently materializable yet. FileScannerV2 can
363
        // describe a projection such as `m.KEYS`, but the downstream file block -> table block path
364
        // still builds a ColumnMap from key column + value column + offsets. If the value child is
365
        // omitted here, TableReader/ColumnMapper cannot reconstruct a valid table MAP column even
366
        // though the query only needs keys.
367
        //
368
        // Example:
369
        //   SELECT map_keys(m) FROM t;
370
        // or
371
        //   SELECT * FROM t WHERE array_contains(map_keys(m), 'k1');
372
        //
373
        // The access path only asks for `m.KEYS`, but the scan still has to read `m.VALUES` as a
374
        // temporary full projection until map materialization supports constructing a table MAP
375
        // from keys only.
376
17
        need_value = true;
377
17
        value_node.project_all = true;
378
17
        value_node.children.clear();
379
17
    }
380
381
472
    if (!need_key && !need_value) {
382
0
        return Status::OK();
383
0
    }
384
385
472
    const auto* key_schema = schema_column != nullptr && !schema_column->children.empty()
386
472
                                     ? schema_column->children.data()
387
472
                                     : nullptr;
388
472
    const auto* value_schema = schema_column != nullptr && schema_column->children.size() > 1
389
472
                                       ? &schema_column->children[1]
390
472
                                       : nullptr;
391
472
    if (need_key) {
392
472
        auto* key_child = find_or_add_child(column, schema_field_id_or(key_schema, 0), "key",
393
472
                                            map_type.get_key_type());
394
472
        inherit_schema_metadata(key_child, key_schema);
395
472
        RETURN_IF_ERROR(build_nested_children_from_access_node(key_child, key_child->type, key_node,
396
472
                                                               path + ".KEYS", key_schema,
397
472
                                                               prefer_exact_name_match));
398
472
    }
399
472
    if (need_value) {
400
472
        auto* value_child = find_or_add_child(column, schema_field_id_or(value_schema, 1), "value",
401
472
                                              map_type.get_value_type());
402
472
        inherit_schema_metadata(value_child, value_schema);
403
472
        RETURN_IF_ERROR(build_nested_children_from_access_node(
404
472
                value_child, value_child->type, value_node, path + ".VALUES", value_schema,
405
472
                prefer_exact_name_match));
406
472
    }
407
471
    return Status::OK();
408
472
}
409
410
Status build_nested_children_from_access_node(format::ColumnDefinition* column,
411
                                              const DataTypePtr& type, const AccessPathNode& node,
412
                                              const std::string& path,
413
                                              const format::ColumnDefinition* schema_column,
414
299k
                                              bool prefer_exact_name_match) {
415
299k
    DORIS_CHECK(column != nullptr);
416
299k
    if (node.project_all || node.children.empty()) {
417
296k
        return build_all_nested_children_from_schema(column, type, path, schema_column,
418
296k
                                                     prefer_exact_name_match);
419
296k
    }
420
421
2.72k
    const auto nested_type = remove_nullable(type);
422
2.72k
    switch (nested_type->get_primitive_type()) {
423
1.98k
    case TYPE_STRUCT:
424
1.98k
        return build_struct_children_from_access_node(
425
1.98k
                column, assert_cast<const DataTypeStruct&>(*nested_type), node, path, schema_column,
426
1.98k
                prefer_exact_name_match);
427
263
    case TYPE_ARRAY: {
428
263
        if (node.children.size() != 1 || !node.children.contains("*")) {
429
2
            return Status::NotSupported(
430
2
                    "AccessPathParser does not support access path {} for slot {}", path,
431
2
                    column->name);
432
2
        }
433
261
        const auto& array_type = assert_cast<const DataTypeArray&>(*nested_type);
434
261
        const auto* element_schema = schema_column != nullptr && !schema_column->children.empty()
435
261
                                             ? schema_column->children.data()
436
261
                                             : nullptr;
437
261
        auto* child = find_or_add_child(column, schema_field_id_or(element_schema, 0), "element",
438
261
                                        array_type.get_nested_type());
439
261
        inherit_schema_metadata(child, element_schema);
440
261
        return build_nested_children_from_access_node(child, child->type, node.children.at("*"),
441
261
                                                      path + ".*", element_schema,
442
261
                                                      prefer_exact_name_match);
443
263
    }
444
474
    case TYPE_MAP:
445
474
        return build_map_children_from_access_node(
446
474
                column, assert_cast<const DataTypeMap&>(*nested_type), node, path, schema_column,
447
474
                prefer_exact_name_match);
448
0
    default:
449
0
        return Status::NotSupported("AccessPathParser does not support access path {} for slot {}",
450
0
                                    path, column->name);
451
2.72k
    }
452
2.72k
}
453
454
} // namespace
455
456
Status AccessPathParser::build_nested_children(format::ColumnDefinition* column,
457
                                               const std::vector<TColumnAccessPath>& access_paths,
458
                                               const format::ColumnDefinition* schema_column,
459
293k
                                               bool prefer_exact_name_match) {
460
293k
    DORIS_CHECK(column != nullptr);
461
293k
    if (is_scanner_materialized_virtual_column(column->name)) {
462
507
        return Status::OK();
463
507
    }
464
292k
    if (!is_complex_type(remove_nullable(column->type)->get_primitive_type())) {
465
190k
        return Status::OK();
466
190k
    }
467
468
102k
    AccessPathNode root;
469
    // Build tree for AccessPathNode.
470
    // For example, for access paths ["a.b", "a.c", "d"], the tree will be:
471
    // root
472
    // ├── a
473
    // │   ├── b
474
    // │   └── c
475
    // └── d
476
102k
    for (const auto& access_path : access_paths) {
477
        // TODO: Support META access paths if needed. Currently AccessPathParser only supports
478
        // DATA access paths.
479
23.8k
        if (access_path.type != TAccessPathType::DATA || !access_path.__isset.data_access_path) {
480
2
            return Status::NotSupported(
481
2
                    "AccessPathParser only supports DATA access paths for slot {}", column->name);
482
2
        }
483
23.8k
        const auto& path = access_path.data_access_path.path;
484
23.8k
        if (path.empty()) {
485
0
            insert_access_path(&root, path, 0);
486
0
            continue;
487
0
        }
488
23.8k
        int32_t top_level_id = -1;
489
23.8k
        if (to_lower(path.front()) != to_lower(column->name) &&
490
23.8k
            (!parse_non_negative_int(path.front(), &top_level_id) ||
491
22.0k
             !column->has_identifier_field_id() ||
492
22.0k
             top_level_id != column->get_identifier_field_id())) {
493
2
            return Status::NotSupported("AccessPathParser access path {} does not match slot {}",
494
2
                                        access_path_to_string(path), column->name);
495
2
        }
496
23.8k
        insert_access_path(&root, path, 1);
497
23.8k
    }
498
    // Recursively build nested children for the column based on the AccessPathNode tree.
499
102k
    return build_nested_children_from_access_node(column, column->type, root, column->name,
500
102k
                                                  schema_column, prefer_exact_name_match);
501
102k
}
502
503
Status AccessPathParser::build_nested_children(format::ColumnDefinition* column,
504
                                               const SlotDescriptor* slot_desc,
505
                                               const format::ColumnDefinition* schema_column,
506
293k
                                               bool prefer_exact_name_match) {
507
293k
    DORIS_CHECK(column != nullptr);
508
293k
    DORIS_CHECK(slot_desc != nullptr);
509
293k
    return build_nested_children(column, slot_desc->all_access_paths(), schema_column,
510
293k
                                 prefer_exact_name_match);
511
293k
}
512
513
} // namespace doris