* [Schema Change] support fast add/drop column (#49) * [feature](schema-change) support fast schema change. coauthor: yixiutt * [schema change] Using columns desc from fe to read data. coauthor: Lchangliang * [feature](schema change) schema change optimize for add/drop columns. 1.add uniqueId field for class column. 2.schema change for add/drop columns directly update schema meta Co-authored-by: yixiutt <yixiu@selectdb.com> Co-authored-by: SWJTU-ZhangLei <1091517373@qq.com> [Feature](schema change) fix write and add regression test (#69) Co-authored-by: yixiutt <yixiu@selectdb.com> [schema change] be ssupport that delete use newest schema add delete regression test fix regression case (#107) tmp [feature](schema change) light schema change exclude rollup and agg/uniq/dup key type. [feature](schema change) fe olapTable maxUniqueId write in disk. [feature](schema change) add rpc iface for sc add column. [feature](schema change) add columnsDesc to TPushReq for ligtht sc. resolve the deadlock when schema change (#124) fix columns from fe don't has bitmap_index flag (#134) add update/delete case construct MATERIALIZED schema from origin schema when insert fix not vectorized compaction coredump use segment cache choose newest schema by schema version when compaction (#182) [bugfix](schema change) fix ligth schema change problem. [feature](schema change) light schema change add alter job. (#1) fix be ut [bug] (schema change) unique drop key column should not light schema change [feature](schema change) add schema change regression-test. fix regression test [bugfix](schema change) fix multi alter clauses for light schema change. (#2) [bugfix](schema change) fix multi clauses calculate column unique id (#3) modify PushTask process (#217) [Bugfix](schema change) fix jobId replay cause bdbje exception. [bug](schema change) fix max col unique id repeatitive. (#232) [optimize](schema change) modify pendingMaxColUniqueId generate rule. fix compaction error * fix be ut * fix snapshot load core fix unique_id error (#278) [refact](fe) remove redundant code for light schema change. (#4) [refact](fe) remove redundant code for light schema change. (#4) format fe core format be core fix be ut modify fe meta version fix rebase error flush schema into rowset_meta in old table [refactor](schema change) refact fe light schema change. (#5) delete the change of schemahash and support get max version schema * modify for review * fix be ut * fix schema change test
44 lines
2.5 KiB
SQL
44 lines
2.5 KiB
SQL
DROP TABLE IF EXISTS schema_change_delete_regression_test;
|
|
|
|
CREATE TABLE schema_change_delete_regression_test (
|
|
`user_id` LARGEINT NOT NULL COMMENT "用户id",
|
|
`date` DATE NOT NULL COMMENT "数据灌入日期时间",
|
|
`city` VARCHAR(20) COMMENT "用户所在城市",
|
|
`age` SMALLINT COMMENT "用户年龄",
|
|
`sex` TINYINT COMMENT "用户性别",
|
|
`last_visit_date` DATETIME DEFAULT "1970-01-01 00:00:00" COMMENT "用户最后一次访问时间",
|
|
`last_update_date` DATETIME DEFAULT "1970-01-01 00:00:00" COMMENT "用户最后一次更新时间",
|
|
`last_visit_date_not_null` DATETIME NOT NULL DEFAULT "1970-01-01 00:00:00" COMMENT "用户最后一次访问时间",
|
|
`cost` BIGINT DEFAULT "0" COMMENT "用户总消费",
|
|
`max_dwell_time` INT DEFAULT "0" COMMENT "用户最大停留时间",
|
|
`min_dwell_time` INT DEFAULT "99999" COMMENT "用户最小停留时间")
|
|
DUPLICATE KEY(`user_id`, `date`, `city`, `age`, `sex`) DISTRIBUTED BY HASH(`user_id`)
|
|
PROPERTIES ( "replication_num" = "1" );
|
|
|
|
INSERT INTO schema_change_delete_regression_test VALUES
|
|
(1, '2017-10-01', 'Beijing', 10, 1, '2020-01-01', '2020-01-01', '2020-01-01', 1, 30, 20);
|
|
|
|
INSERT INTO schema_change_delete_regression_test VALUES
|
|
(2, '2017-10-01', 'Beijing', 10, 1, '2020-01-02', '2020-01-02', '2020-01-02', 1, 31, 21);
|
|
|
|
SELECT * FROM schema_change_delete_regression_test order by user_id ASC, last_visit_date;
|
|
|
|
ALTER table schema_change_delete_regression_test ADD COLUMN new_column INT default "1";
|
|
|
|
SELECT * FROM schema_change_delete_regression_test order by user_id DESC, last_visit_date;
|
|
|
|
INSERT INTO schema_change_delete_regression_test VALUES
|
|
(1, '2017-10-01', 'Beijing', 10, 1, '2020-01-02', '2020-01-02', '2020-01-02', 1, 31, 19, 2);
|
|
|
|
INSERT INTO schema_change_delete_regression_test VALUES
|
|
(2, '2017-10-01', 'Beijing', 10, 1, '2020-01-03', '2020-01-03', '2020-01-03', 1, 32, 20, 2);
|
|
|
|
INSERT INTO schema_change_delete_regression_test VALUES
|
|
(3, '2017-10-01', 'Beijing', 10, 1, '2020-01-03', '2020-01-03', '2020-01-03', 1, 32, 20, 1);
|
|
|
|
INSERT INTO schema_change_delete_regression_test VALUES
|
|
(3, '2017-10-01', 'Beijing', 10, 1, '2020-01-03', '2020-01-03', '2020-01-03', 1, 32, 20, 2);
|
|
|
|
DELETE FROM schema_change_delete_regression_test where new_column = 1;
|
|
|
|
SELECT * FROM schema_change_delete_regression_test order by user_id DESC, last_visit_date; |