This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new cbc498eefa1 [fix](bloom filter)Fix drop column with bloom filter (#41369) (#41710) cbc498eefa1 is described below commit cbc498eefa189ad4504bf7755c0836763c273f3d Author: qiye <jianliang5...@gmail.com> AuthorDate: Mon Oct 14 14:13:22 2024 +0800 [fix](bloom filter)Fix drop column with bloom filter (#41369) (#41710) --- .../apache/doris/alter/SchemaChangeHandler.java | 12 +++++ .../test_bloom_filter_drop_column.out | 8 ++++ .../test_bloom_filter_drop_column.groovy | 51 ++++++++++++++++++++++ 3 files changed, 71 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java index 1fd46769fbf..3df21f88be1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java @@ -411,6 +411,18 @@ public class SchemaChangeHandler extends AlterHandler { throw new DdlException("Column does not exists: " + dropColName); } + // drop bloom filter column + Set<String> bfCols = olapTable.getCopiedBfColumns(); + if (bfCols != null) { + Set<String> newBfCols = new HashSet<>(); + for (String bfCol : bfCols) { + if (!bfCol.equalsIgnoreCase(dropColName)) { + newBfCols.add(bfCol); + } + } + olapTable.setBloomFilterInfo(newBfCols, olapTable.getBfFpp()); + } + for (int i = 1; i < indexIds.size(); i++) { List<Column> rollupSchema = indexSchemaMap.get(indexIds.get(i)); Iterator<Column> iter = rollupSchema.iterator(); diff --git a/regression-test/data/bloom_filter_p0/test_bloom_filter_drop_column.out b/regression-test/data/bloom_filter_p0/test_bloom_filter_drop_column.out new file mode 100644 index 00000000000..2c6ca8d224b --- /dev/null +++ b/regression-test/data/bloom_filter_p0/test_bloom_filter_drop_column.out @@ -0,0 +1,8 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select -- +1 1 + +-- !select -- +1 \N +2 \N + diff --git a/regression-test/suites/bloom_filter_p0/test_bloom_filter_drop_column.groovy b/regression-test/suites/bloom_filter_p0/test_bloom_filter_drop_column.groovy new file mode 100644 index 00000000000..a18ff9fdbe0 --- /dev/null +++ b/regression-test/suites/bloom_filter_p0/test_bloom_filter_drop_column.groovy @@ -0,0 +1,51 @@ +// 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("test_bloom_filter_drop_column") { + def table_name = "test_bloom_filter_drop_column" + + sql """drop TABLE if exists ${table_name}""" + + sql """CREATE TABLE IF NOT EXISTS ${table_name} ( + `a` varchar(150) NULL, + `c1` varchar(10) + ) ENGINE=OLAP + DUPLICATE KEY(`a`) + DISTRIBUTED BY HASH(`a`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "bloom_filter_columns" = "c1", + "in_memory" = "false", + "storage_format" = "V2" + )""" + + sql """INSERT INTO ${table_name} values ('1', '1')""" + + qt_select """select * from ${table_name} order by a""" + + // drop column c1 + sql """ALTER TABLE ${table_name} DROP COLUMN c1""" + // show create table + def res = sql """SHOW CREATE TABLE ${table_name}""" + assert res[0][1].contains("\"bloom_filter_columns\" = \"\"") + + // add new column c1 + sql """ALTER TABLE ${table_name} ADD COLUMN c1 ARRAY<STRING>""" + // insert data + sql """INSERT INTO ${table_name} values ('2', null)""" + // select data + qt_select """select * from ${table_name} order by a""" +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org