csun5285 commented on code in PR #27785: URL: https://github.com/apache/doris/pull/27785#discussion_r1410670021
########## be/src/vec/common/schema_util.cpp: ########## @@ -310,7 +310,7 @@ void update_least_common_schema(const std::vector<TabletSchemaSPtr>& schemas, TabletColumn common_column; // const std::string& column_name = variant_col_name + "." + tuple_paths[i].get_path(); get_column_by_type(tuple_types[i], tuple_paths[i].get_path(), common_column, - ExtraInfo {.unique_id = variant_col_unique_id, + ExtraInfo {.unique_id = -1, .parent_unique_id = variant_col_unique_id, .path_info = tuple_paths[i]}); common_schema->append_column(common_column); Review Comment: common_schema->append_column(common_column, TabletSchema::ColumnType::VARIANT) ########## be/src/vec/common/schema_util.cpp: ########## @@ -310,7 +310,7 @@ void update_least_common_schema(const std::vector<TabletSchemaSPtr>& schemas, TabletColumn common_column; // const std::string& column_name = variant_col_name + "." + tuple_paths[i].get_path(); get_column_by_type(tuple_types[i], tuple_paths[i].get_path(), common_column, - ExtraInfo {.unique_id = variant_col_unique_id, + ExtraInfo {.unique_id = -1, .parent_unique_id = variant_col_unique_id, .path_info = tuple_paths[i]}); common_schema->append_column(common_column); Review Comment: "TabletSchema::ColumnType::VARIANT" means that the appended column is managed using the "_field_path_to_index." ########## regression-test/suites/variant_p0/column_size_limit.groovy: ########## @@ -0,0 +1,52 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("regression_test_variant_column_limit", "nonConcurrent"){ + def set_be_config = { key, value -> + String backend_id; + def backendId_to_backendIP = [:] + def backendId_to_backendHttpPort = [:] + getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort); + + backend_id = backendId_to_backendIP.keySet()[0] + def (code, out, err) = update_be_config(backendId_to_backendIP.get(backend_id), backendId_to_backendHttpPort.get(backend_id), key, value) + logger.info("update config: code=" + code + ", out=" + out + ", err=" + err) + } + def table_name = "var_column_limit" + set_be_config.call("variant_max_merged_tablet_schema_size", "5") + sql "DROP TABLE IF EXISTS ${table_name}" + sql """ + CREATE TABLE IF NOT EXISTS ${table_name} ( + k bigint, + v variant + ) + DUPLICATE KEY(`k`) + DISTRIBUTED BY HASH(k) BUCKETS 1 + properties("replication_num" = "1", "disable_auto_compaction" = "false"); + """ + try { + sql """insert into ${table_name} values (1, '{"a" : 1, "b" : 2, "c" : 3, "d" : 4, "e" : 5}')""" Review Comment: column size is 5 + 1 = 6 ? ########## regression-test/suites/variant_p0/column_size_limit.groovy: ########## @@ -0,0 +1,52 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("regression_test_variant_column_limit", "nonConcurrent"){ + def set_be_config = { key, value -> + String backend_id; + def backendId_to_backendIP = [:] + def backendId_to_backendHttpPort = [:] + getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort); + + backend_id = backendId_to_backendIP.keySet()[0] + def (code, out, err) = update_be_config(backendId_to_backendIP.get(backend_id), backendId_to_backendHttpPort.get(backend_id), key, value) + logger.info("update config: code=" + code + ", out=" + out + ", err=" + err) + } + def table_name = "var_column_limit" + set_be_config.call("variant_max_merged_tablet_schema_size", "5") + sql "DROP TABLE IF EXISTS ${table_name}" + sql """ + CREATE TABLE IF NOT EXISTS ${table_name} ( + k bigint, + v variant + ) + DUPLICATE KEY(`k`) + DISTRIBUTED BY HASH(k) BUCKETS 1 + properties("replication_num" = "1", "disable_auto_compaction" = "false"); + """ + try { + sql """insert into ${table_name} values (1, '{"a" : 1, "b" : 2, "c" : 3, "d" : 4, "e" : 5}')""" Review Comment: Execute this SQL again to confirm that the same column won't be added. -- 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