-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55472 from ClickHouse/cherrypick/23.8/c911c8daf4b…
…d626315d6b67f35ed7ea0f6c476ce Cherry pick #55062 to 23.8: Prevent attaching parts from tables with different projections or indices
- Loading branch information
Showing
4 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/queries/0_stateless/02888_attach_partition_from_different_tables.reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
1 1 | ||
0 0 | ||
1 1 | ||
2 2 | ||
3 3 | ||
4 4 | ||
5 5 | ||
6 6 | ||
7 7 | ||
8 8 | ||
9 9 |
90 changes: 90 additions & 0 deletions
90
tests/queries/0_stateless/02888_attach_partition_from_different_tables.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
-- test different index type | ||
CREATE TABLE attach_partition_t1 ( | ||
a UInt32, | ||
b String, | ||
INDEX bf b TYPE tokenbf_v1(8192, 3, 0) GRANULARITY 1 | ||
) | ||
ENGINE = MergeTree | ||
ORDER BY a; | ||
|
||
INSERT INTO attach_partition_t1 SELECT number, toString(number) FROM numbers(10); | ||
|
||
CREATE TABLE attach_partition_t2 ( | ||
a UInt32, | ||
b String, | ||
INDEX bf b TYPE bloom_filter GRANULARITY 1 | ||
) | ||
ENGINE = MergeTree | ||
ORDER BY a; | ||
|
||
ALTER TABLE attach_partition_t2 ATTACH PARTITION tuple() FROM attach_partition_t1; -- { serverError 36 } | ||
|
||
-- test different projection name | ||
CREATE TABLE attach_partition_t3 ( | ||
a UInt32, | ||
b String, | ||
PROJECTION proj | ||
( | ||
SELECT | ||
b, | ||
sum(a) | ||
GROUP BY b | ||
) | ||
) | ||
ENGINE = MergeTree | ||
ORDER BY a; | ||
|
||
INSERT INTO attach_partition_t3 SELECT number, toString(number) FROM numbers(10); | ||
|
||
CREATE TABLE attach_partition_t4 ( | ||
a UInt32, | ||
b String, | ||
PROJECTION differently_named_proj | ||
( | ||
SELECT | ||
b, | ||
sum(a) | ||
GROUP BY b | ||
) | ||
) | ||
ENGINE = MergeTree | ||
ORDER BY a; | ||
|
||
ALTER TABLE attach_partition_t4 ATTACH PARTITION tuple() FROM attach_partition_t3; -- { serverError 36 } | ||
|
||
-- check attach with same index and projection | ||
CREATE TABLE attach_partition_t5 ( | ||
a UInt32, | ||
b String, | ||
PROJECTION proj | ||
( | ||
SELECT | ||
b, | ||
sum(a) | ||
GROUP BY b | ||
) | ||
) | ||
ENGINE = MergeTree | ||
ORDER BY a; | ||
|
||
INSERT INTO attach_partition_t5 SELECT number, toString(number) FROM numbers(10); | ||
|
||
|
||
CREATE TABLE attach_partition_t6 ( | ||
a UInt32, | ||
b String, | ||
PROJECTION proj | ||
( | ||
SELECT | ||
b, | ||
sum(a) | ||
GROUP BY b | ||
) | ||
) | ||
ENGINE = MergeTree | ||
ORDER BY a; | ||
|
||
ALTER TABLE attach_partition_t6 ATTACH PARTITION tuple() FROM attach_partition_t5; | ||
|
||
SELECT * FROM attach_partition_t6 WHERE b = '1'; | ||
SELECT b, sum(a) FROM attach_partition_t6 GROUP BY b ORDER BY b; |