pick https://github.com/apache/doris/pull/40657
This commit is contained in:
@ -79,6 +79,9 @@ public class InsertOverwriteUtil {
|
||||
ReplacePartitionClause replacePartitionClause = new ReplacePartitionClause(
|
||||
new PartitionNames(false, partitionNames),
|
||||
new PartitionNames(true, tempPartitionNames), properties);
|
||||
if (replacePartitionClause.getTempPartitionNames().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Env.getCurrentEnv()
|
||||
.replaceTempPartition((Database) olapTable.getDatabase(),
|
||||
(OlapTable) olapTable, replacePartitionClause);
|
||||
|
||||
@ -148,12 +148,18 @@ suite("test_iot_auto_detect") {
|
||||
sql """ insert into dt values ("2005-01-01"), ("2013-02-02"), ("2022-03-03"); """
|
||||
sql """ insert overwrite table dt partition(*) values ("2008-01-01"), ("2008-02-02"); """
|
||||
qt_sql " select * from dt order by k0; "
|
||||
try {
|
||||
test {
|
||||
sql """ insert overwrite table dt partition(*) values ("2023-02-02"), ("3000-12-12"); """
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage())
|
||||
assertTrue(e.getMessage().contains('Insert has filtered data in strict mode') ||
|
||||
e.getMessage().contains('Cannot found origin partitions in auto detect overwriting'))
|
||||
}
|
||||
|
||||
check { result, exception, startTime, endTime ->
|
||||
assertTrue(exception.getMessage().contains('Insert has filtered data in strict mode') ||
|
||||
exception.getMessage().contains('Cannot found origin partitions in auto detect overwriting'))
|
||||
}
|
||||
}
|
||||
// test no rows(no partition hits) overwrite
|
||||
sql " drop table if exists dt2"
|
||||
sql " create table dt2 like dt"
|
||||
sql " insert overwrite table dt2 partition(*) select * from dt2"
|
||||
sql " insert overwrite table dt partition(*) select * from dt2"
|
||||
sql " insert overwrite table dt partition(p10, pMAX) select * from dt2"
|
||||
sql " insert overwrite table dt select * from dt2"
|
||||
}
|
||||
|
||||
@ -50,11 +50,9 @@ suite("test_auto_partition_behavior") {
|
||||
result = sql "show partitions from unique_table"
|
||||
assertEquals(result.size(), 10)
|
||||
// add partition
|
||||
try {
|
||||
test {
|
||||
sql """ alter table unique_table add partition padd values in ("Xxx") """
|
||||
fail()
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage().contains("is conflict with current partitionKeys"))
|
||||
exception "is conflict with current partitionKeys"
|
||||
}
|
||||
// drop partition
|
||||
def partitions = sql "show partitions from unique_table order by PartitionName"
|
||||
@ -94,11 +92,9 @@ suite("test_auto_partition_behavior") {
|
||||
result = sql "show partitions from dup_table"
|
||||
assertEquals(result.size(), 10)
|
||||
// add partition
|
||||
try {
|
||||
test {
|
||||
sql """ alter table dup_table add partition padd values in ("Xxx") """
|
||||
fail()
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage().contains("is conflict with current partitionKeys"))
|
||||
exception "is conflict with current partitionKeys"
|
||||
}
|
||||
// drop partition
|
||||
partitions = sql "show partitions from dup_table order by PartitionName"
|
||||
@ -168,11 +164,9 @@ suite("test_auto_partition_behavior") {
|
||||
);
|
||||
"""
|
||||
sql """ insert into rewrite values ("Xxx"); """
|
||||
try {
|
||||
test {
|
||||
sql """ insert overwrite table rewrite partition(p1) values ("") """
|
||||
fail()
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage().contains("Insert has filtered data in strict mode"))
|
||||
exception "Insert has filtered data in strict mode"
|
||||
}
|
||||
sql """ insert overwrite table rewrite partition(p1) values ("Xxx") """
|
||||
qt_sql_overwrite """ select * from rewrite """ // Xxx
|
||||
@ -408,6 +402,9 @@ suite("test_auto_partition_behavior") {
|
||||
part_result = sql " show tablets from test_change "
|
||||
assertEquals(part_result.size, 52 * replicaNum)
|
||||
|
||||
|
||||
|
||||
// test not auto partition have expr.
|
||||
test {
|
||||
sql """
|
||||
CREATE TABLE not_auto_expr (
|
||||
@ -421,4 +418,11 @@ suite("test_auto_partition_behavior") {
|
||||
"""
|
||||
exception "Non-auto partition table not support partition expr!"
|
||||
}
|
||||
|
||||
|
||||
// test insert empty
|
||||
sql "create table if not exists empty_range like test_change"
|
||||
sql "insert into test_change select * from empty_range"
|
||||
sql "create table if not exists empty_list like long_value"
|
||||
sql "insert into long_value select * from empty_list"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user