Skip to content

Commit

Permalink
add sql tester
Browse files Browse the repository at this point in the history
Signed-off-by: smartlxh <[email protected]>
  • Loading branch information
smartlxh committed Nov 4, 2024
1 parent 4c0112b commit 59ce64b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/sql/test_lake_sync_mv/R/test_lake_sync_mv
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- name: test_invalid_json @cloud
CREATE TABLE tbl1 (
k1 date,
k2 int,
v1 int sum
) PARTITION BY RANGE(k1) (
PARTITION p1 values [('2020-01-01'),('2020-02-01')),
PARTITION p2 values [('2020-02-01'),('2020-03-01')))
DISTRIBUTED BY HASH(k2) BUCKETS 3
PROPERTIES('replication_num' = '1');

INSERT INTO tbl1
VALUES
("2020-01-12",4,100),
("2020-01-11",5,100),
("2020-01-11",4,100);

CREATE MATERIALIZED VIEW sync_mv AS SELECT k1, SUM(v1) FROM tbl1 GROUP BY k1;

INSERT INTO tbl1 VALUES("2020-01-11",6,100);
28 changes: 28 additions & 0 deletions test/sql/test_lake_sync_mv/T/test_lake_sync_mv
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- name: test_invalid_json @cloud
CREATE TABLE tbl1 (
k1 date,
k2 int,
v1 int sum
) PARTITION BY RANGE(k1) (
PARTITION p1 values [('2020-01-01'),('2020-02-01')),
PARTITION p2 values [('2020-02-01'),('2020-03-01')))
DISTRIBUTED BY HASH(k2) BUCKETS 3
PROPERTIES('replication_num' = '1');
-- result:
-- !result

INSERT INTO tbl1
VALUES
("2020-01-12",4,100),
("2020-01-11",5,100),
("2020-01-11",4,100);
-- result:
-- !result

CREATE MATERIALIZED VIEW sync_mv AS SELECT k1, SUM(v1) FROM tbl1 GROUP BY k1;
-- result:
-- !result

INSERT INTO tbl1 VALUES("2020-01-11",6,100);
-- result:
-- !result

0 comments on commit 59ce64b

Please sign in to comment.