eldenmoon commented on code in PR #26749: URL: https://github.com/apache/doris/pull/26749#discussion_r1403957377
########## be/src/vec/exec/scan/new_olap_scanner.cpp: ########## @@ -406,6 +411,55 @@ Status NewOlapScanner::_init_tablet_reader_params( return Status::OK(); } +vectorized::PathInData NewOlapScanner::_build_path(SlotDescriptor* slot) { + PathInDataBuilder path_builder; + const std::string& col_name = slot->col_name_lower_case(); + auto delimeter_index = col_name.find("."); + std::string_view root_name = delimeter_index == std::string::npos + ? col_name + : std::string_view(col_name.data(), delimeter_index); + path_builder = path_builder.append(root_name, false); + for (const std::string& path : slot->column_paths()) { + path_builder.append(path, false); + } + return path_builder.build(); +} + +Status NewOlapScanner::_init_variant_columns() { + auto& tablet_schema = _tablet_reader_params.tablet_schema; + // Parent column has path info to distinction from each other + for (auto slot : _output_tuple_desc->slots()) { + if (!slot->is_materialized()) { + continue; + } + if (!slot->need_materialize()) { + continue; + } + if (slot->type().is_variant_type()) { + // Such columns are not exist in frontend schema info, so we need to + // add them into tablet_schema for later column indexing. + TabletColumn subcol; + subcol.set_type(FieldType::OLAP_FIELD_TYPE_VARIANT); + subcol.set_is_nullable(true); + subcol.set_unique_id(slot->col_unique_id()); + subcol.set_parent_unique_id(slot->col_unique_id()); + PathInData path = _build_path(slot); + subcol.set_path_info(path); + subcol.set_name(path.get_path()); + if (tablet_schema->field_index(path) < 0) { + tablet_schema->append_column(subcol, TabletSchema::ColumnType::VARIANT); + } + } else if (!slot->column_paths().empty()) { Review Comment: removed -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org