Skip to content

Commit

Permalink
feat(integration_test): add other starrocks table test (#15363)
Browse files Browse the repository at this point in the history
  • Loading branch information
xxhZs authored Feb 29, 2024
1 parent f267a37 commit 1fd6937
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 5 deletions.
2 changes: 1 addition & 1 deletion integration_tests/starrocks-sink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Login to mysql
docker compose exec starrocks-fe mysql -uroot -P9030 -h127.0.0.1
```

Run the following queries to create database and table.
Run the following queries to create database and table. You also use other starrocks table, example in ./starrocks_prepare.sql
```sql
CREATE database demo;
use demo;
Expand Down
49 changes: 47 additions & 2 deletions integration_tests/starrocks-sink/create_sink.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE SINK bhv_starrocks_sink
CREATE SINK bhv_starrocks_sink_primary
FROM
bhv_mv WITH (
connector = 'starrocks',
Expand All @@ -9,7 +9,52 @@ FROM
starrocks.user = 'users',
starrocks.password = '123456',
starrocks.database = 'demo',
starrocks.table = 'demo_bhv_table',
starrocks.table = 'demo_primary_table',
force_append_only='true'
);

CREATE SINK bhv_starrocks_sink_duplicate
FROM
bhv_mv WITH (
connector = 'starrocks',
type = 'append-only',
starrocks.host = 'starrocks-fe',
starrocks.mysqlport = '9030',
starrocks.httpport = '8030',
starrocks.user = 'users',
starrocks.password = '123456',
starrocks.database = 'demo',
starrocks.table = 'demo_duplicate_table',
force_append_only='true'
);

CREATE SINK bhv_starrocks_sink_aggregate
FROM
bhv_mv WITH (
connector = 'starrocks',
type = 'append-only',
starrocks.host = 'starrocks-fe',
starrocks.mysqlport = '9030',
starrocks.httpport = '8030',
starrocks.user = 'users',
starrocks.password = '123456',
starrocks.database = 'demo',
starrocks.table = 'demo_aggregate_table',
force_append_only='true'
);

CREATE SINK bhv_starrocks_sink_unique
FROM
bhv_mv WITH (
connector = 'starrocks',
type = 'append-only',
starrocks.host = 'starrocks-fe',
starrocks.mysqlport = '9030',
starrocks.httpport = '8030',
starrocks.user = 'users',
starrocks.password = '123456',
starrocks.database = 'demo',
starrocks.table = 'demo_unique_table',
force_append_only='true'
);

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/starrocks-sink/sink_check.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import subprocess
import sys

relations = ['demo.demo_bhv_table', 'demo.upsert_table']
relations = ['demo.demo_primary_table','demo.demo_duplicate_table','demo.demo_aggregate_table','demo.demo_unique_table', 'demo.upsert_table']

failed_cases = []
for rel in relations:
Expand Down
26 changes: 25 additions & 1 deletion integration_tests/starrocks-sink/starrocks_prepare.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE database demo;
use demo;

CREATE table demo_bhv_table(
CREATE table demo_primary_table(
user_id int,
target_id text,
event_timestamp_local datetime
Expand All @@ -17,5 +17,29 @@ CREATE table upsert_table(
PRIMARY KEY(`user_id`)
DISTRIBUTED BY HASH(`user_id`) properties("replication_num" = "1");

CREATE table demo_duplicate_table(
user_id int,
target_id text,
event_timestamp_local datetime
) ENGINE=OLAP
DUPLICATE KEY(`user_id`)
DISTRIBUTED BY HASH(`user_id`) properties("replication_num" = "1");

CREATE table demo_aggregate_table(
user_id int,
target_id text,
event_timestamp_local datetime
) ENGINE=OLAP
AGGREGATE KEY(`user_id`,`target_id`,`event_timestamp_local`)
DISTRIBUTED BY HASH(`user_id`) properties("replication_num" = "1");

CREATE table demo_unique_table(
user_id int,
target_id text,
event_timestamp_local datetime
) ENGINE=OLAP
UNIQUE KEY(`user_id`)
DISTRIBUTED BY HASH(`user_id`) properties("replication_num" = "1");

CREATE USER 'users'@'%' IDENTIFIED BY '123456';
GRANT ALL ON *.* TO 'users'@'%';

0 comments on commit 1fd6937

Please sign in to comment.