Skip to content

Commit 2dcddd0

Browse files
[UT] Add SQL integration tests for light_weight_tablet_creation
Covers the user-visible surface of light_weight_tablet_creation across two files under test/sql/test_light_weight_tablet_creation/: test_basic (12 cases): * Hash / random / range / list distribution variants * Range and list partition variants (explicit + auto-by-expression) * Range distribution on a PRIMARY KEY table (requires enable_range_distribution = true) * ADD PARTITION, TRUNCATE TABLE, INSERT OVERWRITE test_alter (5 cases): * ALTER false -> true and true -> false (the latter exercises the PR-7 backfill path) * ALTER with an invalid value must error * Schema Change MODIFY COLUMN on a light-weight table, waiting via function: wait_alter_table_finish() * ADD ROLLUP on a light-weight table, waiting via function: wait_table_rollup_finish() Dynamic partition (1.8), shared-nothing OLAP rejection (Case 2), the FE restart edit-log replay sequence (Case 5), and all SHOW PARTITIONS / SHOW PROC / OSS-side ossutil checks from the manual test scripts are intentionally not integrated - they either need wall-clock timing, variable IDs, the wrong cluster mode, or external tooling that the test/sql harness cannot diff deterministically. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c0a774b commit 2dcddd0

4 files changed

Lines changed: 688 additions & 0 deletions

File tree

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
-- name: test_light_weight_tablet_creation_alter
2+
create database db_${uuid0};
3+
-- result:
4+
-- !result
5+
use db_${uuid0};
6+
-- result:
7+
-- !result
8+
CREATE TABLE t_alter_basic (
9+
c0 INT,
10+
c1 STRING
11+
) DUPLICATE KEY(c0)
12+
DISTRIBUTED BY HASH(c0) BUCKETS 4
13+
PROPERTIES("light_weight_tablet_creation" = "false");
14+
-- result:
15+
-- !result
16+
ALTER TABLE t_alter_basic SET("light_weight_tablet_creation" = "true");
17+
-- result:
18+
-- !result
19+
SHOW CREATE TABLE t_alter_basic;
20+
-- result:
21+
t_alter_basic CREATE TABLE `t_alter_basic` (
22+
`c0` int(11) NULL COMMENT "",
23+
`c1` varchar(65533) NULL COMMENT ""
24+
) ENGINE=OLAP
25+
DUPLICATE KEY(`c0`)
26+
COMMENT "OLAP"
27+
DISTRIBUTED BY HASH(`c0`) BUCKETS 4
28+
PROPERTIES (
29+
"cloud_native_fast_schema_evolution_v2" = "true",
30+
"compression" = "LZ4",
31+
"datacache.enable" = "true",
32+
"enable_async_write_back" = "false",
33+
"file_bundling" = "true",
34+
"light_weight_tablet_creation" = "true",
35+
"replication_num" = "1",
36+
"storage_volume" = "builtin_storage_volume"
37+
);
38+
-- !result
39+
INSERT INTO t_alter_basic VALUES (1, 'a'), (2, 'b');
40+
-- result:
41+
-- !result
42+
SELECT * FROM t_alter_basic ORDER BY c0;
43+
-- result:
44+
1 a
45+
2 b
46+
-- !result
47+
ALTER TABLE t_alter_basic SET("light_weight_tablet_creation" = "invalid");
48+
-- result:
49+
E: (5064, 'Getting analyzing error. Detail message: Property light_weight_tablet_creation must be bool type(false/true).')
50+
-- !result
51+
ALTER TABLE t_alter_basic SET("light_weight_tablet_creation" = "false");
52+
-- result:
53+
-- !result
54+
SHOW CREATE TABLE t_alter_basic;
55+
-- result:
56+
t_alter_basic CREATE TABLE `t_alter_basic` (
57+
`c0` int(11) NULL COMMENT "",
58+
`c1` varchar(65533) NULL COMMENT ""
59+
) ENGINE=OLAP
60+
DUPLICATE KEY(`c0`)
61+
COMMENT "OLAP"
62+
DISTRIBUTED BY HASH(`c0`) BUCKETS 4
63+
PROPERTIES (
64+
"cloud_native_fast_schema_evolution_v2" = "true",
65+
"compression" = "LZ4",
66+
"datacache.enable" = "true",
67+
"enable_async_write_back" = "false",
68+
"file_bundling" = "true",
69+
"light_weight_tablet_creation" = "false",
70+
"replication_num" = "1",
71+
"storage_volume" = "builtin_storage_volume"
72+
);
73+
-- !result
74+
INSERT INTO t_alter_basic VALUES (3, 'c');
75+
-- result:
76+
-- !result
77+
SELECT * FROM t_alter_basic ORDER BY c0;
78+
-- result:
79+
1 a
80+
2 b
81+
3 c
82+
-- !result
83+
DROP TABLE t_alter_basic;
84+
-- result:
85+
-- !result
86+
CREATE TABLE t_schema_change (
87+
c0 INT,
88+
c1 VARCHAR(10)
89+
) DUPLICATE KEY(c0)
90+
DISTRIBUTED BY HASH(c0) BUCKETS 4
91+
PROPERTIES("light_weight_tablet_creation" = "true");
92+
-- result:
93+
-- !result
94+
INSERT INTO t_schema_change VALUES (1, 'a'), (2, 'b');
95+
-- result:
96+
-- !result
97+
ALTER TABLE t_schema_change MODIFY COLUMN c1 INT;
98+
-- result:
99+
-- !result
100+
function: wait_alter_table_finish()
101+
-- result:
102+
None
103+
-- !result
104+
DESC t_schema_change;
105+
-- result:
106+
c0 int YES true None
107+
c1 int YES false None
108+
-- !result
109+
SELECT * FROM t_schema_change ORDER BY c0;
110+
-- result:
111+
1 0
112+
2 0
113+
-- !result
114+
INSERT INTO t_schema_change VALUES (3, 30), (4, 40);
115+
-- result:
116+
-- !result
117+
SELECT * FROM t_schema_change ORDER BY c0;
118+
-- result:
119+
1 0
120+
2 0
121+
3 30
122+
4 40
123+
-- !result
124+
DROP TABLE t_schema_change;
125+
-- result:
126+
-- !result
127+
CREATE TABLE t_rollup (
128+
c0 INT,
129+
c1 STRING,
130+
c2 BIGINT
131+
) DUPLICATE KEY(c0)
132+
DISTRIBUTED BY HASH(c0) BUCKETS 4
133+
PROPERTIES("light_weight_tablet_creation" = "true");
134+
-- result:
135+
-- !result
136+
INSERT INTO t_rollup VALUES (1, 'a', 100), (2, 'b', 200);
137+
-- result:
138+
-- !result
139+
ALTER TABLE t_rollup ADD ROLLUP rollup_c0_c1 (c0, c1);
140+
-- result:
141+
-- !result
142+
function: wait_alter_table_finish("ROLLUP", 8)
143+
-- result:
144+
None
145+
-- !result
146+
SELECT c0, c1 FROM t_rollup ORDER BY c0;
147+
-- result:
148+
1 a
149+
2 b
150+
-- !result
151+
INSERT INTO t_rollup VALUES (3, 'c', 300);
152+
-- result:
153+
-- !result
154+
SELECT * FROM t_rollup ORDER BY c0;
155+
-- result:
156+
1 a 100
157+
2 b 200
158+
3 c 300
159+
-- !result
160+
DROP TABLE t_rollup;
161+
-- result:
162+
-- !result
163+
DROP DATABASE db_${uuid0};
164+
-- result:
165+
-- !result

0 commit comments

Comments
 (0)