Skip to content

Commit

Permalink
fix(integration_tests): use timestamptz for MySQL, TiDB, Doris, Sta…
Browse files Browse the repository at this point in the history
…rRocks and ClickHouse
  • Loading branch information
xiangjinwu committed Nov 24, 2023
1 parent 9ae8705 commit ae847f0
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 42 deletions.
4 changes: 2 additions & 2 deletions integration_tests/clickhouse-sink/create_source.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE TABLE user_behaviors (
user_id INT,
target_id VARCHAR,
target_type VARCHAR,
event_timestamp TIMESTAMP,
event_timestamp TIMESTAMPTZ,
behavior_type VARCHAR,
parent_target_type VARCHAR,
parent_target_id VARCHAR,
Expand All @@ -15,4 +15,4 @@ CREATE TABLE user_behaviors (
fields.user_name.kind = 'random',
fields.user_name.length = '10',
datagen.rows.per.second = '50'
) FORMAT PLAIN ENCODE JSON;
) FORMAT PLAIN ENCODE JSON;
2 changes: 1 addition & 1 deletion integration_tests/doris-sink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use demo;
CREATE table demo_bhv_table(
user_id int,
target_id text,
event_timestamp datetime
event_timestamp_local datetime
) UNIQUE KEY(`user_id`)
DISTRIBUTED BY HASH(`user_id`) BUCKETS 1
PROPERTIES (
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/doris-sink/append-only-sql/create_mv.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ CREATE MATERIALIZED VIEW bhv_mv AS
SELECT
user_id,
target_id,
event_timestamp
event_timestamp AT TIME ZONE 'Asia/Shanghai' as event_timestamp_local
FROM
user_behaviors;
user_behaviors;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE table user_behaviors (
user_id int,
target_id VARCHAR,
target_type VARCHAR,
event_timestamp TIMESTAMP,
event_timestamp TIMESTAMPTZ,
behavior_type VARCHAR,
parent_target_type VARCHAR,
parent_target_id VARCHAR,
Expand All @@ -15,4 +15,4 @@ CREATE table user_behaviors (
fields.user_name.kind = 'random',
fields.user_name.length = '10',
datagen.rows.per.second = '10'
) FORMAT PLAIN ENCODE JSON;
) FORMAT PLAIN ENCODE JSON;
4 changes: 2 additions & 2 deletions integration_tests/doris-sink/upsert/create_mv.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ CREATE MATERIALIZED VIEW bhv_mv AS
SELECT
user_id,
target_id,
event_timestamp
event_timestamp AT TIME ZONE 'Asia/Shanghai' as event_timestamp_local
FROM
user_behaviors;
user_behaviors;
4 changes: 2 additions & 2 deletions integration_tests/doris-sink/upsert/create_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ CREATE table user_behaviors (
user_id int,
target_id VARCHAR,
target_type VARCHAR,
event_timestamp TIMESTAMP,
event_timestamp TIMESTAMPTZ,
behavior_type VARCHAR,
parent_target_type VARCHAR,
parent_target_id VARCHAR,
PRIMARY KEY(user_id)
);
);
10 changes: 5 additions & 5 deletions integration_tests/doris-sink/upsert/insert_update_delete.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
INSERT INTO user_behaviors VALUES(1,'1','1','2020-01-01 01:01:01','1','1','1'),
(2,'2','2','2020-01-01 01:01:02','2','2','2'),
(3,'3','3','2020-01-01 01:01:03','3','3','3'),
(4,'4','4','2020-01-01 01:01:04','4','4','4');
INSERT INTO user_behaviors VALUES(1,'1','1','2020-01-01T01:01:01Z','1','1','1'),
(2,'2','2','2020-01-01T01:01:02Z','2','2','2'),
(3,'3','3','2020-01-01T01:01:03Z','3','3','3'),
(4,'4','4','2020-01-01T01:01:04Z','4','4','4');

DELETE FROM user_behaviors WHERE user_id = 2;

UPDATE user_behaviors SET target_id = 30 WHERE user_id = 3;
UPDATE user_behaviors SET target_id = 30 WHERE user_id = 3;
3 changes: 2 additions & 1 deletion integration_tests/mysql-sink/create_mv.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ CREATE TABLE rw_typed_data (
boolean_column BOOLEAN,
date_column DATE,
time_column TIME,
timestamp_column TIMESTAMPTZ,
timestamp_column TIMESTAMP,
timestamptz_column TIMESTAMPTZ,
jsonb_column JSONB,
bytea_column BYTEA
) WITH (
Expand Down
13 changes: 7 additions & 6 deletions integration_tests/mysql-sink/create_source.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ CREATE TABLE data_types (
date_column DATE,
time_column TIME,
timestamp_column TIMESTAMP,
timestamptz_column TIMESTAMPTZ,
jsonb_column JSONB,
bytea_column BYTEA
);
Expand All @@ -41,10 +42,10 @@ FROM
primary_key = 'id'
);

INSERT INTO data_types (id, varchar_column, text_column, integer_column, smallint_column, bigint_column, decimal_column, real_column, double_column, boolean_column, date_column, time_column, timestamp_column, jsonb_column, bytea_column)
INSERT INTO data_types (id, varchar_column, text_column, integer_column, smallint_column, bigint_column, decimal_column, real_column, double_column, boolean_column, date_column, time_column, timestamp_column, timestamptz_column, jsonb_column, bytea_column)
VALUES
(1, 'Varchar value 1', 'Text value 1', 123, 456, 789, 12.34, 56.78, 90.12, TRUE, '2023-05-22', '12:34:56', '2023-05-22 12:34:56', '{"key": "value"}', E'\\xDEADBEEF'),
(2, 'Varchar value 2', 'Text value 2', 234, 567, 890, 23.45, 67.89, 01.23, FALSE, '2023-05-23', '23:45:01', '2023-05-23 23:45:01', '{"key": "value2"}', E'\\xFEEDBEEF'),
(3, 'Varchar value 3', 'Text value 3', 345, 678, 901, 34.56, 78.90, 12.34, TRUE, '2023-05-24', '12:34:56', '2023-05-24 12:34:56', '{"key": "value3"}', E'\\xCAFEBABE'),
(4, 'Varchar value 4', 'Text value 4', 456, 789, 012, 45.67, 89.01, 23.45, FALSE, '2023-05-25', '23:45:01', '2023-05-25 23:45:01', '{"key": "value4"}', E'\\xBABEC0DE'),
(5, 'Varchar value 5', 'Text value 5', 567, 890, 123, 56.78, 90.12, 34.56, TRUE, '2023-05-26', '12:34:56', '2023-05-26 12:34:56', '{"key": "value5"}', E'\\xDEADBABE');
(1, 'Varchar value 1', 'Text value 1', 123, 456, 789, 12.34, 56.78, 90.12, TRUE, '2023-05-22', '12:34:56', '2023-05-22 12:34:56', '2023-05-22T12:34:56Z', '{"key": "value"}', E'\\xDEADBEEF'),
(2, 'Varchar value 2', 'Text value 2', 234, 567, 890, 23.45, 67.89, 01.23, FALSE, '2023-05-23', '23:45:01', '2023-05-23 23:45:01', '2023-05-23T23:45:01Z', '{"key": "value2"}', E'\\xFEEDBEEF'),
(3, 'Varchar value 3', 'Text value 3', 345, 678, 901, 34.56, 78.90, 12.34, TRUE, '2023-05-24', '12:34:56', '2023-05-24 12:34:56', '2023-05-24T12:34:56Z', '{"key": "value3"}', E'\\xCAFEBABE'),
(4, 'Varchar value 4', 'Text value 4', 456, 789, 012, 45.67, 89.01, 23.45, FALSE, '2023-05-25', '23:45:01', '2023-05-25 23:45:01', '2023-05-25T23:45:01Z', '{"key": "value4"}', E'\\xBABEC0DE'),
(5, 'Varchar value 5', 'Text value 5', 567, 890, 123, 56.78, 90.12, 34.56, TRUE, '2023-05-26', '12:34:56', '2023-05-26 12:34:56', '2023-05-26T12:34:56Z', '{"key": "value5"}', E'\\xDEADBABE');
5 changes: 3 additions & 2 deletions integration_tests/mysql-sink/mysql_prepare.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ CREATE TABLE data_types (
boolean_column BOOLEAN,
date_column DATE,
time_column TIME,
timestamp_column TIMESTAMP,
timestamp_column DATETIME,
timestamptz_column TIMESTAMP,
jsonb_column JSON,
bytea_column BLOB
);
);
2 changes: 1 addition & 1 deletion integration_tests/starrocks-sink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use demo;
CREATE table demo_bhv_table(
user_id int,
target_id text,
event_timestamp datetime
event_timestamp_local datetime
) ENGINE=OLAP
PRIMARY KEY(`user_id`)
DISTRIBUTED BY HASH(`user_id`) properties("replication_num" = "1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ CREATE MATERIALIZED VIEW bhv_mv AS
SELECT
user_id,
target_id,
event_timestamp
event_timestamp AT TIME ZONE 'Asia/Shanghai' as event_timestamp_local
FROM
user_behaviors;
user_behaviors;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE table user_behaviors (
user_id int,
target_id VARCHAR,
target_type VARCHAR,
event_timestamp TIMESTAMP,
event_timestamp TIMESTAMPTZ,
behavior_type VARCHAR,
parent_target_type VARCHAR,
parent_target_id VARCHAR,
Expand All @@ -15,4 +15,4 @@ CREATE table user_behaviors (
fields.user_name.kind = 'random',
fields.user_name.length = '10',
datagen.rows.per.second = '10'
) FORMAT PLAIN ENCODE JSON;
) FORMAT PLAIN ENCODE JSON;
4 changes: 2 additions & 2 deletions integration_tests/starrocks-sink/upsert/create_mv.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ CREATE MATERIALIZED VIEW bhv_mv AS
SELECT
user_id,
target_id,
event_timestamp
event_timestamp AT TIME ZONE 'Asia/Shanghai' as event_timestamp_local
FROM
user_behaviors;
user_behaviors;
4 changes: 2 additions & 2 deletions integration_tests/starrocks-sink/upsert/create_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ CREATE table user_behaviors (
user_id int,
target_id VARCHAR,
target_type VARCHAR,
event_timestamp TIMESTAMP,
event_timestamp TIMESTAMPTZ,
behavior_type VARCHAR,
parent_target_type VARCHAR,
parent_target_id VARCHAR,
PRIMARY KEY(user_id)
);
);
10 changes: 5 additions & 5 deletions integration_tests/starrocks-sink/upsert/insert_update_delete.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
INSERT INTO user_behaviors VALUES(1,'1','1','2020-01-01 01:01:01','1','1','1'),
(2,'2','2','2020-01-01 01:01:02','2','2','2'),
(3,'3','3','2020-01-01 01:01:03','3','3','3'),
(4,'4','4','2020-01-01 01:01:04','4','4','4');
INSERT INTO user_behaviors VALUES(1,'1','1','2020-01-01T01:01:01Z','1','1','1'),
(2,'2','2','2020-01-01T01:01:02Z','2','2','2'),
(3,'3','3','2020-01-01T01:01:03Z','3','3','3'),
(4,'4','4','2020-01-01T01:01:04Z','4','4','4');

DELETE FROM user_behaviors WHERE user_id = 2;

UPDATE user_behaviors SET target_id = 30 WHERE user_id = 3;
UPDATE user_behaviors SET target_id = 30 WHERE user_id = 3;
6 changes: 3 additions & 3 deletions integration_tests/tidb-cdc-sink/create_source.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE TABLE tweet (
id varchar,
text varchar,
lang varchar,
created_at timestamp,
created_at timestamptz,
author_id varchar,
PRIMARY KEY (id)
) WITH (
Expand All @@ -17,7 +17,7 @@ create table user (
name varchar,
username varchar,
followers bigint,
created_at timestamp,
created_at timestamptz,
PRIMARY KEY (id)
) WITH (
connector='kafka',
Expand All @@ -40,7 +40,7 @@ create table datatype (
c9_date date,
c10_datetime timestamp,
c11_time time,
c12_timestamp timestamp,
c12_timestamp timestamptz,
c13_char varchar,
c14_varchar varchar,
c15_binary bytea,
Expand Down

0 comments on commit ae847f0

Please sign in to comment.