Skip to content

Commit

Permalink
sql test
Browse files Browse the repository at this point in the history
Signed-off-by: Murphy <[email protected]>
  • Loading branch information
murphyatwork committed Sep 4, 2024
1 parent f5e89ff commit c9272df
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 0 deletions.
102 changes: 102 additions & 0 deletions test/sql/test_analyze_statistics/R/test_analyze_column
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
-- name: test_analyze_columnn
create database analyze_test_${uuid0};
-- result:
-- !result
use analyze_test_${uuid0};
-- result:
-- !result
CREATE TABLE `t1` (
`k1` date,
`k2` datetime,
`k3` char(20),
`k4` varchar(20),
`k5` boolean,
`k6` tinyint,
`k7` smallint,
`k8` int,
`k9` bigint,
`k10` largeint,
`k11` float,
`k12` double,
`k13` decimal(27,9) )
DUPLICATE KEY(`k1`, `k2`, `k3`, `k4`, `k5`)
DISTRIBUTED BY HASH(`k1`, `k2`, `k3`) BUCKETS 3
PROPERTIES ('replication_num' = '1');
-- result:
-- !result
admin set frontend config('enable_statistic_collect_on_first_load'='false');
-- result:
-- !result
INSERT INTO t1 VALUES
('2020-10-22','2020-10-23 12:12:12','k3','k4',0,1,2,3,4,5,1.1,1.12,2.889),
('2020-10-23','2020-10-24 12:12:12','k3','k4',0,0,2,3,4,5,1.1,1.12,2.889),
('2020-10-24','2020-10-25 12:12:12','k3','k4',0,1,2,3,4,5,1.1,1.12,2.889),
(null,'2020-10-26 12:12:12',null,null,null,null,null,null,null,null,1,1.12,2.889),
(null,'2020-10-27 12:12:12','k3','k4',0,1,2,3,4,5,1.1,1.12,2.889);
-- result:
-- !result
[UC] analyze sample table t1;
-- result:
analyze_test_8a14e06f2aaa4d4aa329877dfd869c7b.t1 sample status OK
-- !result
show stats meta where `database` = 'analyze_test_${uuid0}';
-- result:
[REGEX]analyze_test_.* t1 ALL SAMPLE .* {} 100%
-- !result
[UC] analyze full table t1\(k1,k2\);
-- result:
analyze_test_8a14e06f2aaa4d4aa329877dfd869c7b.t1 analyze status OK
-- !result
show stats meta where `database` = 'analyze_test_${uuid0}';
-- result:
[REGEX]analyze_test_.* t1 ALL SAMPLE .* {} 100% \(k1,FULL\),\(k2,FULL\)
-- !result
[UC] analyze full table t1\(k3,k4\);
-- result:
analyze_test_8a14e06f2aaa4d4aa329877dfd869c7b.t1 analyze status OK
-- !result
show stats meta where `database` = 'analyze_test_${uuid0}';
-- result:
[REGEX]analyze_test_.* t1 ALL SAMPLE .* {} 100% \(k1,FULL\),\(k2,FULL\),\(k3,FULL\),\(k4,FULL\)
-- !result
[UC] analyze sample table t1\(k3,k4\);
-- result:
analyze_test_8a14e06f2aaa4d4aa329877dfd869c7b.t1 sample status OK
-- !result
show stats meta where `database` = 'analyze_test_${uuid0}';
-- result:
[REGEX]analyze_test_.* t1 ALL SAMPLE .* {} 100% \(k1,FULL\),\(k2,FULL\),\(k3,SAMPLE\),\(k4,SAMPLE\)
-- !result
[UC] analyze sample table t1;
-- result:
analyze_test_8a14e06f2aaa4d4aa329877dfd869c7b.t1 sample status OK
-- !result
show stats meta where `database` = 'analyze_test_${uuid0}';
-- result:
[REGEX]analyze_test_.* t1 ALL SAMPLE .* {} 100% \(k1,FULL\),\(k2,FULL\),\(k3,SAMPLE\),\(k4,SAMPLE\)
-- !result
[UC] analyze full table t1;
-- result:
analyze_test_8a14e06f2aaa4d4aa329877dfd869c7b.t1 analyze status OK
-- !result
show stats meta where `database` = 'analyze_test_${uuid0}';
-- result:
[REGEX]analyze_test_.* t1 ALL FULL .* {} 100% \(k1,FULL\),\(k2,FULL\),\(k3,SAMPLE\),\(k4,SAMPLE\)
-- !result
[UC] drop stats t1;
-- result:
-- !result
show stats meta where `database` = 'analyze_test_${uuid0}';
-- result:
-- !result
[UC] analyze sample table t1;
-- result:
analyze_test_8a14e06f2aaa4d4aa329877dfd869c7b.t1 sample status OK
-- !result
show stats meta where `database` = 'analyze_test_${uuid0}';
-- result:
[REGEX]analyze_test_.* t1 ALL SAMPLE .* {} 100%
-- !result
admin set frontend config('enable_statistic_collect_on_first_load'='true');
-- result:
-- !result
56 changes: 56 additions & 0 deletions test/sql/test_analyze_statistics/T/test_analyze_column
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
-- name: test_analyze_columnn
create database analyze_test_${uuid0};
use analyze_test_${uuid0};

CREATE TABLE `t1` (
`k1` date,
`k2` datetime,
`k3` char(20),
`k4` varchar(20),
`k5` boolean,
`k6` tinyint,
`k7` smallint,
`k8` int,
`k9` bigint,
`k10` largeint,
`k11` float,
`k12` double,
`k13` decimal(27,9) )
DUPLICATE KEY(`k1`, `k2`, `k3`, `k4`, `k5`)
DISTRIBUTED BY HASH(`k1`, `k2`, `k3`) BUCKETS 3
PROPERTIES ('replication_num' = '1');

admin set frontend config('enable_statistic_collect_on_first_load'='false');

INSERT INTO t1 VALUES
('2020-10-22','2020-10-23 12:12:12','k3','k4',0,1,2,3,4,5,1.1,1.12,2.889),
('2020-10-23','2020-10-24 12:12:12','k3','k4',0,0,2,3,4,5,1.1,1.12,2.889),
('2020-10-24','2020-10-25 12:12:12','k3','k4',0,1,2,3,4,5,1.1,1.12,2.889),
(null,'2020-10-26 12:12:12',null,null,null,null,null,null,null,null,1,1.12,2.889),
(null,'2020-10-27 12:12:12','k3','k4',0,1,2,3,4,5,1.1,1.12,2.889);

[UC] analyze sample table t1;
show stats meta where `database` = 'analyze_test_${uuid0}';

[UC] analyze full table t1(k1,k2);
show stats meta where `database` = 'analyze_test_${uuid0}';

[UC] analyze full table t1(k3,k4);
show stats meta where `database` = 'analyze_test_${uuid0}';

[UC] analyze sample table t1(k3,k4);
show stats meta where `database` = 'analyze_test_${uuid0}';

[UC] analyze sample table t1;
show stats meta where `database` = 'analyze_test_${uuid0}';

[UC] analyze full table t1;
show stats meta where `database` = 'analyze_test_${uuid0}';

[UC] drop stats t1;
show stats meta where `database` = 'analyze_test_${uuid0}';

[UC] analyze sample table t1;
show stats meta where `database` = 'analyze_test_${uuid0}';

admin set frontend config('enable_statistic_collect_on_first_load'='true');

0 comments on commit c9272df

Please sign in to comment.