-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support altering the target table’s columns of the sink. (#17203)
- Loading branch information
Showing
21 changed files
with
826 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
statement ok | ||
create table t_simple_1 (v1 int); | ||
|
||
statement ok | ||
create table m_simple (v1 int primary key); | ||
|
||
statement ok | ||
create sink s_simple_1 into m_simple as select v1 from t_simple_1; | ||
|
||
statement ok | ||
insert into t_simple_1 values (1), (2), (3); | ||
|
||
statement ok | ||
flush; | ||
|
||
query I rowsort | ||
select * from m_simple; | ||
---- | ||
1 | ||
2 | ||
3 | ||
|
||
statement ok | ||
alter table m_simple add column v2 int; | ||
|
||
statement ok | ||
insert into t_simple_1 values (4); | ||
|
||
statement ok | ||
flush; | ||
|
||
query II rowsort | ||
select * from m_simple; | ||
---- | ||
1 NULL | ||
2 NULL | ||
3 NULL | ||
4 NULL | ||
|
||
statement ok | ||
create table t_simple_2 (v1 int, v2 int); | ||
|
||
statement ok | ||
create sink s_simple_2 into m_simple as select v1, v2 from t_simple_2; | ||
|
||
statement ok | ||
insert into t_simple_2 values (100, 101), (200, 201), (300, 301); | ||
|
||
statement ok | ||
flush; | ||
|
||
query II rowsort | ||
select * from m_simple; | ||
---- | ||
1 NULL | ||
100 101 | ||
2 NULL | ||
200 201 | ||
3 NULL | ||
300 301 | ||
4 NULL | ||
|
||
statement error dropping columns in target table of sinks is not supported | ||
alter table m_simple drop column v2; | ||
|
||
statement ok | ||
drop sink s_simple_1; | ||
|
||
statement ok | ||
drop sink s_simple_2; | ||
|
||
statement ok | ||
drop table t_simple_1; | ||
|
||
statement ok | ||
drop table t_simple_2; | ||
|
||
statement ok | ||
drop table m_simple; | ||
|
||
# target table with row_id as primary key | ||
statement ok | ||
create table t_s1 (v1 int); | ||
|
||
statement ok | ||
insert into t_s1 values (1), (2), (3); | ||
|
||
statement ok | ||
create table t_row_id_as_primary_key (v1 int, v2 int default 1000); | ||
|
||
statement ok | ||
create sink s1 into t_row_id_as_primary_key as select v1 from t_s1 with (type = 'append-only', force_append_only = 'true'); | ||
|
||
statement ok | ||
flush; | ||
|
||
query II rowsort | ||
select * from t_row_id_as_primary_key; | ||
---- | ||
1 1000 | ||
2 1000 | ||
3 1000 | ||
|
||
statement ok | ||
alter table t_row_id_as_primary_key add column v3 int; | ||
|
||
query III rowsort | ||
select * from t_row_id_as_primary_key; | ||
---- | ||
1 1000 NULL | ||
2 1000 NULL | ||
3 1000 NULL | ||
|
||
statement ok | ||
create sink s11 into t_row_id_as_primary_key as select v1+1000 as v1, v1+2000 as v2, v1+3000 as v3 from t_s1 with (type = 'append-only', force_append_only = 'true'); | ||
|
||
statement ok | ||
flush; | ||
|
||
query III rowsort | ||
select * from t_row_id_as_primary_key; | ||
---- | ||
1 1000 NULL | ||
1001 2001 3001 | ||
1002 2002 3002 | ||
1003 2003 3003 | ||
2 1000 NULL | ||
3 1000 NULL | ||
|
||
statement ok | ||
drop sink s1; | ||
|
||
statement ok | ||
drop sink s11; | ||
|
||
statement ok | ||
drop table t_row_id_as_primary_key; | ||
|
||
statement ok | ||
drop table t_s1; | ||
|
||
# target table with append only | ||
statement ok | ||
create table t_s2 (v1 int); | ||
|
||
statement ok | ||
insert into t_s2 values (1), (2), (3); | ||
|
||
statement ok | ||
create table t_append_only (v1 int, v2 int default 1000) append only; | ||
|
||
statement ok | ||
create sink s2 into t_append_only as select v1 from t_s2 with (type = 'append-only', force_append_only = 'true'); | ||
|
||
statement ok | ||
flush; | ||
|
||
query II rowsort | ||
select * from t_append_only; | ||
---- | ||
1 1000 | ||
2 1000 | ||
3 1000 | ||
|
||
statement ok | ||
alter table t_append_only add column v3 int; | ||
|
||
query III rowsort | ||
select * from t_append_only; | ||
---- | ||
1 1000 NULL | ||
2 1000 NULL | ||
3 1000 NULL | ||
|
||
statement ok | ||
create sink s21 into t_append_only as select v1+1000 as v1, v1+2000 as v2, v1+3000 as v3 from t_s2 with (type = 'append-only', force_append_only = 'true'); | ||
|
||
query III rowsort | ||
select * from t_append_only; | ||
---- | ||
1 1000 NULL | ||
1001 2001 3001 | ||
1002 2002 3002 | ||
1003 2003 3003 | ||
2 1000 NULL | ||
3 1000 NULL | ||
|
||
statement ok | ||
drop sink s21; | ||
|
||
statement ok | ||
drop sink s2; | ||
|
||
statement ok | ||
drop table t_append_only; | ||
|
||
statement ok | ||
drop table t_s2; |
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
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
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
Oops, something went wrong.