Skip to content
Merged
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
4 changes: 2 additions & 2 deletions be/src/olap/schema_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ Status VSchemaChangeDirectly::_inner_process(RowsetReaderSharedPtr rowset_reader
bool eof = false;
do {
auto new_block = vectorized::Block::create_unique(new_tablet_schema->create_block());
auto ref_block = vectorized::Block::create_unique(base_tablet_schema->create_block());
auto ref_block = vectorized::Block::create_unique(base_tablet_schema->create_block(false));

auto st = rowset_reader->next_block(ref_block.get());
if (!st) {
Expand Down Expand Up @@ -621,7 +621,7 @@ Status VBaseSchemaChangeWithSorting::_inner_process(RowsetReaderSharedPtr rowset

bool eof = false;
do {
auto ref_block = vectorized::Block::create_unique(base_tablet_schema->create_block());
auto ref_block = vectorized::Block::create_unique(base_tablet_schema->create_block(false));
auto st = rowset_reader->next_block(ref_block.get());
if (!st) {
if (st.is<ErrorCode::END_OF_FILE>()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
2 2
3 3
4 4
5 5

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// 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_non_overlap_seg_heavy_sc") {
def tblName = "test_non_overlap_seg_heavy_sc"
sql """
DROP TABLE IF EXISTS ${tblName}_src
"""
sql """
CREATE TABLE IF NOT EXISTS ${tblName}_src
(
k INT NOT NULL,
v1 INT NOT NULL,
v2 INT NOT NULL
)
DUPLICATE KEY(k)
DISTRIBUTED BY HASH(k) BUCKETS 5
PROPERTIES(
"replication_num" = "1",
"light_schema_change" = "true",
"disable_auto_compaction" = "true"
);
"""

sql """
DROP TABLE IF EXISTS ${tblName}_dst
"""
sql """
CREATE TABLE IF NOT EXISTS ${tblName}_dst
(
k INT NOT NULL,
v1 INT NOT NULL,
v2 INT NOT NULL
)
DUPLICATE KEY(k)
DISTRIBUTED BY HASH(k) BUCKETS 1
PROPERTIES(
"replication_num" = "1",
"light_schema_change" = "true",
"disable_auto_compaction" = "true"
);
"""

sql """ INSERT INTO ${tblName}_src VALUES (1, 1, 1),(2, 2, 2),(3, 3, 3),(4, 4, 4),(5, 5, 5) """

sql """ INSERT INTO ${tblName}_dst SELECT * FROM ${tblName}_src """

sql """ DELETE FROM ${tblName}_dst WHERE v1 = 1 """

sql """ ALTER TABLE ${tblName}_dst DROP COLUMN v1"""

sql """ ALTER TABLE ${tblName}_dst MODIFY COLUMN v2 STRING NOT NULL """

waitForSchemaChangeDone {
sql """ SHOW ALTER TABLE COLUMN WHERE TableName='${tblName}_dst' ORDER BY createtime DESC LIMIT 1 """
time 600
}

qt_sql """ SELECT * FROM ${tblName}_dst ORDER BY k """
}
Loading