Skip to content

Commit a7d9df6

Browse files
h3n4lclaude
andcommitted
test(doris): expand SQL test coverage with additional examples
Add 29 new SQL test files and update existing ones to provide comprehensive test coverage across multiple Doris SQL feature categories: - Account management: alter user, drop user, roles, set password, show grants - Catalog operations: alter, create, drop, show catalogs - Cluster management: backend, broker, frontend, resource, storage, workload - Table operations: alter table (property, rename, replace, rollup) - Index operations: create, drop, build index - Async materialized views - Functions and plugins - Statistics, recovery, and security Total test files: 50 (up from 21) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 76c2980 commit a7d9df6

33 files changed

Lines changed: 451 additions & 4 deletions
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER USER jack@'%' IDENTIFIED BY "12345";
2+
ALTER USER jack@'%' FAILED_LOGIN_ATTEMPTS 3 PASSWORD_LOCK_TIME 1 DAY;
3+
ALTER USER jack@'%' ACCOUNT_UNLOCK;
4+
ALTER USER jack@'%' COMMENT "this is my first user"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP USER 'jack'@'192.%'

doris/examples/account_revoke.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ REVOKE USAGE_PRIV ON COMPUTE GROUP 'group1' FROM 'jack'@'%';
77
REVOKE USAGE_PRIV ON COMPUTE GROUP 'group1' FROM ROLE 'my_role';
88
REVOKE USAGE_PRIV ON STORAGE VAULT 'vault1' FROM 'jack'@'%';
99
REVOKE USAGE_PRIV ON STORAGE VAULT 'vault1' FROM ROLE 'my_role';
10-
REVOKE USAGE_PRIV ON STORAGE VAULT '%' FROM 'jack'@'%'
10+
REVOKE USAGE_PRIV ON STORAGE VAULT '%' FROM 'jack'@'%';

doris/examples/account_role.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CREATE ROLE role1;
2+
CREATE ROLE role2 COMMENT "this is my first role";
3+
DROP ROLE role1;
4+
DROP ROLE IF EXISTS role1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SET PASSWORD = PASSWORD('123456');
2+
SET PASSWORD = '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9';
3+
SET PASSWORD FOR 'jack'@'192.%' = PASSWORD('123456');
4+
SET PASSWORD FOR 'jack'@'domain' = '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9'

doris/examples/account_show.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SHOW ALL GRANTS;
2+
SHOW GRANTS FOR jack@'%';
3+
SHOW GRANTS;
4+
SHOW ROLES
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
CREATE MATERIALIZED VIEW complete_mv (orderdate COMMENT 'Order date', orderkey COMMENT 'Order key', partkey COMMENT 'Part key')
2+
BUILD IMMEDIATE
3+
REFRESH AUTO
4+
ON SCHEDULE EVERY 1 DAY STARTS '2024-12-01 20:30:00'
5+
DISTRIBUTED BY HASH (orderkey) BUCKETS 2
6+
PROPERTIES("replication_num" = "1")
7+
AS
8+
SELECT
9+
o_orderdate,
10+
l_orderkey,
11+
l_partkey
12+
FROM orders
13+
LEFT JOIN lineitem ON l_orderkey = o_orderkey
14+
LEFT JOIN partsupp ON ps_partkey = l_partkey AND l_suppkey = ps_suppkey;
15+
16+
CREATE MATERIALIZED VIEW partition_mv
17+
BUILD IMMEDIATE
18+
REFRESH AUTO
19+
ON SCHEDULE EVERY 1 DAY STARTS '2024-12-01 20:30:00'
20+
PARTITION BY (DATE_TRUNC(o_orderdate, 'MONTH'))
21+
DISTRIBUTED BY HASH (l_orderkey) BUCKETS 2
22+
PROPERTIES("replication_num" = "3")
23+
AS
24+
SELECT
25+
o_orderdate,
26+
l_orderkey,
27+
l_partkey
28+
FROM orders
29+
LEFT JOIN lineitem ON l_orderkey = o_orderkey
30+
LEFT JOIN partsupp ON ps_partkey = l_partkey AND l_suppkey = ps_suppkey;
31+
32+
ALTER MATERIALIZED VIEW partition_mv SET ("grace_period" = "10", "excluded_trigger_tables" = "lineitem,partsupp");
33+
ALTER MATERIALIZED VIEW partition_mv REFRESH COMPLETE;
34+
DROP MATERIALIZED VIEW mv1;
35+
DROP MATERIALIZED VIEW IF EXISTS db1.mv1;
36+
REFRESH MATERIALIZED VIEW mv1 AUTO;
37+
REFRESH MATERIALIZED VIEW mv1 PARTITIONS(p_19950801_19950901, p_19950901_19951001);
38+
REFRESH MATERIALIZED VIEW mv1 COMPLETE

doris/examples/catalog_alter.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER CATALOG ctlg_hive RENAME hive;
2+
ALTER CATALOG hive SET PROPERTIES ('hive.metastore.uris'='thrift://172.21.0.1:9083');
3+
ALTER CATALOG hive MODIFY COMMENT "new catalog comment"

doris/examples/catalog_create.sql

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
CREATE CATALOG hive COMMENT 'hive catalog' PROPERTIES (
2+
'type'='hms',
3+
'hive.metastore.uris' = 'thrift://127.0.0.1:7004',
4+
'dfs.nameservices'='HANN',
5+
'dfs.ha.namenodes.HANN'='nn1,nn2',
6+
'dfs.namenode.rpc-address.HANN.nn1'='nn1_host:rpc_port',
7+
'dfs.namenode.rpc-address.HANN.nn2'='nn2_host:rpc_port',
8+
'dfs.client.failover.proxy.provider.HANN'='org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider'
9+
);
10+
CREATE CATALOG es PROPERTIES (
11+
"type"="es",
12+
"hosts"="http://127.0.0.1:9200"
13+
);
14+
CREATE CATALOG jdbc PROPERTIES (
15+
"type"="jdbc",
16+
"user"="root",
17+
"password"="123456",
18+
"jdbc_url" = "jdbc:mysql://127.0.0.1:3316/doris_test?useSSL=false",
19+
"driver_url" = "https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/jdbc_driver/mysql-connector-java-8.0.25.jar",
20+
"driver_class" = "com.mysql.cj.jdbc.Driver"
21+
);
22+
CREATE CATALOG jdbc_pg PROPERTIES (
23+
"type"="jdbc",
24+
"user"="postgres",
25+
"password"="123456",
26+
"jdbc_url" = "jdbc:postgresql://127.0.0.1:5432/demo",
27+
"driver_url" = "file:///path/to/postgresql-42.5.1.jar",
28+
"driver_class" = "org.postgresql.Driver"
29+
);
30+
CREATE CATALOG jdbc_clickhouse PROPERTIES (
31+
"type"="jdbc",
32+
"user"="default",
33+
"password"="123456",
34+
"jdbc_url" = "jdbc:clickhouse://127.0.0.1:8123/demo",
35+
"driver_url" = "file:///path/to/clickhouse-jdbc-0.3.2-patch11-all.jar",
36+
"driver_class" = "com.clickhouse.jdbc.ClickHouseDriver"
37+
);
38+
CREATE CATALOG jdbc_oracle PROPERTIES (
39+
"type"="jdbc",
40+
"user"="doris",
41+
"password"="123456",
42+
"jdbc_url" = "jdbc:oracle:thin:@127.0.0.1:1521:helowin",
43+
"driver_url" = "file:///path/to/ojdbc8.jar",
44+
"driver_class" = "oracle.jdbc.driver.OracleDriver"
45+
);
46+
CREATE CATALOG sqlserver_catalog PROPERTIES (
47+
"type"="jdbc",
48+
"user"="SA",
49+
"password"="Doris123456",
50+
"jdbc_url" = "jdbc:sqlserver://localhost:1433;DataBaseName=doris_test",
51+
"driver_url" = "file:///path/to/mssql-jdbc-11.2.3.jre8.jar",
52+
"driver_class" = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
53+
);
54+
CREATE CATALOG saphana_catalog PROPERTIES (
55+
"type"="jdbc",
56+
"user"="SYSTEM",
57+
"password"="SAPHANA",
58+
"jdbc_url" = "jdbc:sap://localhost:31515/TEST",
59+
"driver_url" = "file:///path/to/ngdbc.jar",
60+
"driver_class" = "com.sap.db.jdbc.Driver"
61+
);
62+
CREATE CATALOG trino_catalog PROPERTIES (
63+
"type"="jdbc",
64+
"user"="hadoop",
65+
"password"="",
66+
"jdbc_url" = "jdbc:trino://localhost:8080/hive",
67+
"driver_url" = "file:///path/to/trino-jdbc-389.jar",
68+
"driver_class" = "io.trino.jdbc.TrinoDriver"
69+
);
70+
CREATE CATALOG oceanbase_catalog PROPERTIES (
71+
"type"="jdbc",
72+
"user"="root",
73+
"password"="",
74+
"jdbc_url" = "jdbc:oceanbase://localhost:2881/demo",
75+
"driver_url" = "file:///path/to/oceanbase-client-2.4.2.jar",
76+
"driver_class" = "com.oceanbase.jdbc.Driver"
77+
)

doris/examples/catalog_drop.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DROP CATALOG hive;
2+
DROP CATALOG IF EXISTS hive

0 commit comments

Comments
 (0)