-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cdc): support INCLUDE TIMESTAMP for MySQL, PG and MongoDB cdc ta…
…ble (#16833)
- Loading branch information
Showing
28 changed files
with
487 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ select cnt from shipments_cnt; | |
4 | ||
|
||
query ITTTT | ||
select * from person_new order by id; | ||
SELECT id,name,email_address,credit_card,city from person_new order by id; | ||
---- | ||
1000 vicky noris [email protected] 7878 5821 1864 2539 cheyenne | ||
1001 peter white [email protected] 1781 2313 8157 6974 boise | ||
|
@@ -68,7 +68,7 @@ SELECT * from orders_test_cnt | |
5 | ||
|
||
query ITT | ||
SELECT * FROM rw.products_test order by id limit 3 | ||
SELECT id,name,description FROM rw.products_test order by id limit 3 | ||
---- | ||
101 RW Small 2-wheel scooter | ||
102 RW 12V car battery | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ create table rw.products_test ( id INT, | |
name STRING, | ||
description STRING, | ||
PRIMARY KEY (id) | ||
) from mysql_mytest table 'mytest.products'; | ||
) include timestamp as commit_ts from mysql_mytest table 'mytest.products'; | ||
|
||
system ok | ||
mysql --protocol=tcp -u root mytest -e "INSERT INTO products VALUES (default,'Milk','Milk is a white liquid food'); | ||
|
@@ -145,12 +145,25 @@ SELECT * from orders_test_cnt | |
4 | ||
|
||
query ITT | ||
SELECT * FROM rw.products_test order by id limit 3 | ||
SELECT id,name,description FROM rw.products_test order by id limit 3 | ||
---- | ||
101 scooter Small 2-wheel scooter | ||
102 car battery 12V car battery | ||
103 12-pack drill bits 12-pack of drill bits with sizes ranging from #40 to #3 | ||
|
||
# commit_ts of historical records should be '1970-01-01 00:00:00+00:00' | ||
query I | ||
SELECT count(*) as cnt from rw.products_test where commit_ts = '1970-01-01 00:00:00+00:00' | ||
---- | ||
9 | ||
|
||
# commit_ts of new records should greater than '1970-01-01 00:00:00+00:00' | ||
query TTT | ||
SELECT name,description FROM rw.products_test where commit_ts > '1970-01-01 00:00:00+00:00' order by id | ||
---- | ||
Milk Milk is a white liquid food | ||
Juice 100ml Juice | ||
|
||
query ITTT | ||
SELECT order_id,order_date,customer_name,product_id FROM orders_test order by order_id limit 3 | ||
---- | ||
|
@@ -230,7 +243,7 @@ CREATE TABLE person_new ( | |
credit_card varchar, | ||
city varchar, | ||
PRIMARY KEY (id) | ||
) FROM pg_source TABLE 'public.person'; | ||
) INCLUDE TIMESTAMP AS commit_ts FROM pg_source TABLE 'public.person'; | ||
|
||
statement ok | ||
CREATE MATERIALIZED VIEW person_new_cnt AS SELECT COUNT(*) AS cnt FROM person_new; | ||
|
@@ -260,7 +273,7 @@ SELECT * from person_new_cnt | |
6 | ||
|
||
query ITTTT | ||
SELECT * from person_new order by id; | ||
SELECT id,name,email_address,credit_card,city from person_new order by id; | ||
---- | ||
1000 vicky noris [email protected] 7878 5821 1864 2539 cheyenne | ||
1001 peter white [email protected] 1781 2313 8157 6974 boise | ||
|
@@ -269,6 +282,22 @@ SELECT * from person_new order by id; | |
1101 white [email protected] 8157 6974 se | ||
1102 spencer [email protected] 9481 6270 angeles | ||
|
||
# historical data | ||
query ITTTT | ||
SELECT id,name,email_address,credit_card,city from person_new where commit_ts = '1970-01-01 00:00:00+00:00' order by id; | ||
---- | ||
1000 vicky noris [email protected] 7878 5821 1864 2539 cheyenne | ||
1001 peter white [email protected] 1781 2313 8157 6974 boise | ||
1002 sarah spencer [email protected] 3453 4987 9481 6270 los angeles | ||
|
||
# incremental data | ||
query ITTTT | ||
SELECT id,name,email_address,credit_card,city from person_new where commit_ts > '1970-01-01 00:00:00+00:00' order by id; | ||
---- | ||
1100 noris [email protected] 1864 2539 enne | ||
1101 white [email protected] 8157 6974 se | ||
1102 spencer [email protected] 9481 6270 angeles | ||
|
||
statement ok | ||
CREATE TABLE numeric_to_rw_int256_shared ( | ||
id int, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.