Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](bloom filter)Fix drop column with bloom filter (#41369) #41710

Open
wants to merge 1 commit into
base: branch-2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,18 @@ private boolean processDropColumn(DropColumnClause alterClause, OlapTable olapTa
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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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"""
}
Loading