Gabriel39 commented on code in PR #66206:
URL: https://github.com/apache/doris/pull/66206#discussion_r3674831668
##########
be/src/exec/scan/access_path_parser.cpp:
##########
@@ -470,6 +470,44 @@ Status
AccessPathParser::build_nested_children(format::ColumnDefinition* column,
if (is_scanner_materialized_virtual_column(column->name)) {
return Status::OK();
}
+ if (remove_nullable(column->type)->get_primitive_type() == TYPE_VARIANT) {
+ column->variant_access_paths.clear();
+ for (const auto& access_path : access_paths) {
+ if (access_path.type != TAccessPathType::DATA ||
+ !access_path.__isset.data_access_path) {
+ return Status::NotSupported(
+ "AccessPathParser only supports DATA access paths for
Variant slot {}",
+ column->name);
+ }
+ const auto& path = access_path.data_access_path.path;
+ if (path.empty()) {
+ // Match the generic access-path tree: an empty DATA path
denotes the whole slot
+ // and dominates every narrower Variant path in the same
request.
+ column->variant_access_paths.clear();
+ return Status::OK();
+ }
+ int32_t top_level_id = -1;
+ if (to_lower(path.front()) != to_lower(column->name) &&
+ (!parse_non_negative_int(path.front(), &top_level_id) ||
+ !column->has_identifier_field_id() ||
+ top_level_id != column->get_identifier_field_id())) {
+ return Status::NotSupported(
+ "AccessPathParser access path {} does not match
Variant slot {}",
+ access_path_to_string(path), column->name);
+ }
+ if (path.size() == 1) {
+ // A whole-root access covers every subpath and must disable
physical leaf pruning.
+ column->variant_access_paths.clear();
+ return Status::OK();
+ }
+ column->variant_access_paths.emplace_back(path.begin() + 1,
path.end());
Review Comment:
Fixed conservatively. Leaf projection is enabled only for one nonempty
object-key segment that is not NULL, numeric-only, or dot-containing;
lossy/colliding paths retain the full Variant projection. Added tests for
numeric, dotted, NULL-sentinel, empty, and multi-segment collisions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]