[UT] Fix print_hit_materialized_views to ensure the result deterministic (#63862)
Signed-off-by: shuming.li <ming.moriarty@gmail.com>
This commit is contained in:
parent
e7ea42635d
commit
1785077e7b
|
|
@ -2195,6 +2195,8 @@ class StarrocksSQLApiLib(object):
|
|||
mv_name = None
|
||||
if content.find("TABLE:") > 0:
|
||||
mv_name = content.split("TABLE:")[1].strip()
|
||||
# sort the mv_names to make the result deterministic
|
||||
ans.sort()
|
||||
return ",".join(ans)
|
||||
return self._with_materialized_view_rewrite(extract_mvs)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
-- name: test_mv_swap
|
||||
-- name: test_mv_swap @slow
|
||||
admin set frontend config('enable_mv_automatic_active_check'='false');
|
||||
-- result:
|
||||
-- !result
|
||||
|
|
@ -116,6 +116,10 @@ AS SELECT sum_sum_pv + 1 FROM mv_on_mv_1;
|
|||
ALTER MATERIALIZED VIEW mv1 SWAP WITH mv2;
|
||||
-- result:
|
||||
-- !result
|
||||
select sleep(3);
|
||||
-- result:
|
||||
1
|
||||
-- !result
|
||||
SELECT IS_ACTIVE, INACTIVE_REASON FROM information_schema.materialized_views WHERE table_name = 'mv_on_mv_1' and TABLE_SCHEMA='db_${uuid0}';
|
||||
-- result:
|
||||
false base-table swapped: mv1
|
||||
|
|
@ -143,6 +147,10 @@ false base-mv inactive: mv_on_mv_1
|
|||
ALTER MATERIALIZED VIEW mv1 SWAP WITH mv2;
|
||||
-- result:
|
||||
-- !result
|
||||
select sleep(3);
|
||||
-- result:
|
||||
1
|
||||
-- !result
|
||||
ALTER MATERIALIZED VIEW mv_on_mv_1 ACTIVE;
|
||||
-- result:
|
||||
-- !result
|
||||
|
|
@ -167,6 +175,10 @@ AS SELECT ss.event_day, sum(ss.pv) as ss_sum_pv, sum(jj.pv) as jj_sum_pv
|
|||
ALTER TABLE ss SWAP WITH jj;
|
||||
-- result:
|
||||
-- !result
|
||||
select sleep(3);
|
||||
-- result:
|
||||
1
|
||||
-- !result
|
||||
SELECT IS_ACTIVE, INACTIVE_REASON FROM information_schema.materialized_views WHERE table_name = 'mv_on_table_1' and TABLE_SCHEMA='db_${uuid0}';
|
||||
-- result:
|
||||
false base-table swapped: jj
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
-- name: test_mv_swap
|
||||
-- name: test_mv_swap @slow
|
||||
|
||||
admin set frontend config('enable_mv_automatic_active_check'='false');
|
||||
|
||||
|
|
@ -51,6 +51,8 @@ AS SELECT sum_sum_pv + 1 FROM mv_on_mv_1;
|
|||
[UC]REFRESH MATERIALIZED VIEW mv_on_mv_2 with sync mode;
|
||||
-- swap intermediate MV
|
||||
ALTER MATERIALIZED VIEW mv1 SWAP WITH mv2;
|
||||
select sleep(3);
|
||||
|
||||
SELECT IS_ACTIVE, INACTIVE_REASON FROM information_schema.materialized_views WHERE table_name = 'mv_on_mv_1' and TABLE_SCHEMA='db_${uuid0}';
|
||||
SELECT IS_ACTIVE, INACTIVE_REASON FROM information_schema.materialized_views WHERE table_name = 'mv_on_mv_2' and TABLE_SCHEMA='db_${uuid0}';
|
||||
ALTER MATERIALIZED VIEW mv_on_mv_1 ACTIVE;
|
||||
|
|
@ -59,6 +61,8 @@ SELECT IS_ACTIVE, INACTIVE_REASON FROM information_schema.materialized_views WHE
|
|||
SELECT IS_ACTIVE, INACTIVE_REASON FROM information_schema.materialized_views WHERE table_name = 'mv_on_mv_2' and TABLE_SCHEMA='db_${uuid0}';
|
||||
-- swap back
|
||||
ALTER MATERIALIZED VIEW mv1 SWAP WITH mv2;
|
||||
select sleep(3);
|
||||
|
||||
ALTER MATERIALIZED VIEW mv_on_mv_1 ACTIVE;
|
||||
ALTER MATERIALIZED VIEW mv_on_mv_2 ACTIVE;
|
||||
SELECT IS_ACTIVE, INACTIVE_REASON FROM information_schema.materialized_views WHERE table_name = 'mv_on_mv_1' and TABLE_SCHEMA='db_${uuid0}';
|
||||
|
|
@ -71,6 +75,8 @@ AS SELECT ss.event_day, sum(ss.pv) as ss_sum_pv, sum(jj.pv) as jj_sum_pv
|
|||
GROUP BY ss.event_day;
|
||||
[UC]REFRESH MATERIALIZED VIEW mv_on_table_1 with sync mode ;
|
||||
ALTER TABLE ss SWAP WITH jj;
|
||||
select sleep(3);
|
||||
|
||||
SELECT IS_ACTIVE, INACTIVE_REASON FROM information_schema.materialized_views WHERE table_name = 'mv_on_table_1' and TABLE_SCHEMA='db_${uuid0}';
|
||||
ALTER MATERIALIZED VIEW mv_on_table_1 ACTIVE;
|
||||
SELECT IS_ACTIVE, INACTIVE_REASON FROM information_schema.materialized_views WHERE table_name = 'mv_on_table_1' and TABLE_SCHEMA='db_${uuid0}';
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ North Subregion 2.8018867924528297
|
|||
-- !result
|
||||
function: print_hit_materialized_views("SELECT subregion_name, CAST(SUM(total_amount) AS DOUBLE) / CAST(SUM(distance_km) AS DOUBLE) AS avg_fare_per_km FROM fact_orders AS f LEFT JOIN mv_region_geohash AS r ON CAST(r.geohash AS varchar)= CAST(f.geohash AS varchar) WHERE DATE_TRUNC('day', local_time) >= DATE_TRUNC('hour', STR_TO_DATE('2025-08-25 00:00:00', '%Y-%m-%d %H:%i:%S')) AND DATE_TRUNC('day', local_time) < DATE_TRUNC('hour', STR_TO_DATE('2025-09-01 00:00:00', '%Y-%m-%d %H:%i:%S')) AND date_id >= 20230623 AND date_id < 20250903 AND (country_id = 4 and city_id in (6) and vehicle_id in (16866, 16860, 16859, 16810, 15829, 15828, 15827, 15826, 15825, 15824, 15817, 15816, 15568, 15272, 15271, 15270, 15269, 15268, 15267, 15266, 15265, 13912, 13904, 13806, 13805, 13804, 13803, 13802, 13801, 13800, 13799, 13456, 13341, 12138, 11770, 11655, 11631, 10742, 10540, 10500, 10499, 10498, 10496, 10495, 10494, 10493, 10492, 10491, 10490, 10489, 10488, 10487, 10486, 10485, 10484, 10479, 9979, 9450, 9338, 8920, 8522, 8183, 7387, 6709, 6705, 4894, 4152, 4131, 3455, 2792, 2742, 2275, 462, 302, 187, 156, 69, 21, 20, 19, 11) and (order_code != '' and order_status = 'booked')) GROUP BY 1 LIMIT 10001;")
|
||||
-- result:
|
||||
mv_region_geohash,mv_fact_orders_1
|
||||
mv_fact_orders_1,mv_region_geohash
|
||||
-- !result
|
||||
INSERT INTO dim_region VALUES
|
||||
(4, 'Mountain View', 'Region', 4, 1, 103, 'Hill Town', 'Rural', 'REG004', 'Residential', 'CountryA', 'TerritoryY', 'RegionW', 'Hill Town', 'North', 'Highland', 'Scenic Area', ['geohash7', 'geohash8'], [4001, 4002]);
|
||||
|
|
@ -224,7 +224,7 @@ North Subregion 2.8018867924528297
|
|||
-- !result
|
||||
function: print_hit_materialized_views("SELECT subregion_name, CAST(SUM(total_amount) AS DOUBLE) / CAST(SUM(distance_km) AS DOUBLE) AS avg_fare_per_km FROM fact_orders AS f LEFT JOIN mv_region_geohash AS r ON CAST(r.geohash AS varchar)= CAST(f.geohash AS varchar) WHERE DATE_TRUNC('day', local_time) >= DATE_TRUNC('hour', STR_TO_DATE('2025-08-25 00:00:00', '%Y-%m-%d %H:%i:%S')) AND DATE_TRUNC('day', local_time) < DATE_TRUNC('hour', STR_TO_DATE('2025-09-01 00:00:00', '%Y-%m-%d %H:%i:%S')) AND date_id >= 20230623 AND date_id < 20250903 AND (country_id = 4 and city_id in (6) and vehicle_id in (16866, 16860, 16859, 16810, 15829, 15828, 15827, 15826, 15825, 15824, 15817, 15816, 15568, 15272, 15271, 15270, 15269, 15268, 15267, 15266, 15265, 13912, 13904, 13806, 13805, 13804, 13803, 13802, 13801, 13800, 13799, 13456, 13341, 12138, 11770, 11655, 11631, 10742, 10540, 10500, 10499, 10498, 10496, 10495, 10494, 10493, 10492, 10491, 10490, 10489, 10488, 10487, 10486, 10485, 10484, 10479, 9979, 9450, 9338, 8920, 8522, 8183, 7387, 6709, 6705, 4894, 4152, 4131, 3455, 2792, 2742, 2275, 462, 302, 187, 156, 69, 21, 20, 19, 11) and (order_code != '' and order_status = 'booked')) GROUP BY 1 LIMIT 10001;")
|
||||
-- result:
|
||||
mv_region_geohash,mv_fact_orders_1
|
||||
mv_fact_orders_1,mv_region_geohash
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW mv_fact_orders_1 WITH SYNC MODE;
|
||||
REFRESH MATERIALIZED VIEW mv_fact_orders_2 WITH SYNC MODE;
|
||||
|
|
|
|||
|
|
@ -2,12 +2,6 @@
|
|||
set new_planner_optimize_timeout=10000;
|
||||
-- result:
|
||||
-- !result
|
||||
create database db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
use db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
create external catalog mv_iceberg_${uuid0}
|
||||
properties
|
||||
(
|
||||
|
|
@ -17,6 +11,99 @@ properties
|
|||
);
|
||||
-- result:
|
||||
-- !result
|
||||
set catalog mv_iceberg_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
create database sql_test_db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
use sql_test_db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
CREATE TABLE t1 (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1),
|
||||
l_shipdate STRING,
|
||||
l_commitdate STRING,
|
||||
l_receiptdate STRING,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44)
|
||||
);
|
||||
-- result:
|
||||
-- !result
|
||||
INSERT INTO t1 VALUES( 1, 1001, 5001, 1, 10.00, 1000.00, 0.05, 0.08, 'N', 'O', '2024-11-12', '2024-11-15', '2024-11-20', 'DELIVER IN PERSON', 'AIR', 'Quick delivery required');
|
||||
-- result:
|
||||
-- !result
|
||||
INSERT INTO t1 VALUES (2, 1002, 5002, 2, 20.00, 2000.00, 0.10, 0.15, 'R', 'F', '2024-11-13', '2024-11-16', '2024-11-21', 'TAKE BACK RETURN', 'RAIL', 'Handle with care');
|
||||
-- result:
|
||||
-- !result
|
||||
INSERT INTO t1 VALUES (3, 1003, 5003, 3, 30.00, 3000.00, 0.15, 0.20, 'A', 'P', '2024-11-14', '2024-11-17', '2024-11-22', 'NONE', 'SHIP', 'Fragile item');
|
||||
-- result:
|
||||
-- !result
|
||||
CREATE TABLE lineitem_date (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_commitdate DATE,
|
||||
l_receiptdate DATE,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44),
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1),
|
||||
l_shipdate DATE
|
||||
) PARTITION BY (l_returnflag, l_linestatus, l_shipdate);
|
||||
-- result:
|
||||
-- !result
|
||||
INSERT INTO lineitem_date SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment, l_returnflag, l_linestatus, to_date(l_shipdate) FROM t1;
|
||||
-- result:
|
||||
-- !result
|
||||
CREATE TABLE lineitem_hours (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_commitdate DATETIME,
|
||||
l_receiptdate DATETIME,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44),
|
||||
l_shipdate DATETIME,
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1)
|
||||
) PARTITION BY hour(l_shipdate), l_returnflag, l_linestatus;
|
||||
-- result:
|
||||
-- !result
|
||||
INSERT INTO lineitem_hours SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment, l_shipdate, l_returnflag, l_linestatus FROM t1;
|
||||
-- result:
|
||||
-- !result
|
||||
set catalog default_catalog;
|
||||
-- result:
|
||||
-- !result
|
||||
create database db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
use db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
set materialized_view_rewrite_mode='force';
|
||||
-- result:
|
||||
-- !result
|
||||
|
|
@ -25,19 +112,19 @@ PARTITION BY (l_returnflag, l_linestatus, l_shipdate)
|
|||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES ("replication_num" = "1")
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date;
|
||||
-- result:
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_date PARTITION (('R', 'F', '2024-11-13 00:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
|
|
@ -48,31 +135,31 @@ SELECT count(*) FROM test_date;
|
|||
SELECT * FROM test_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care R F 2024-11-13
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 2024-11-22 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care R F 2024-11-13
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 2024-11-22 NONE SHIP Fragile item A P 2024-11-14
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 2024-11-15 2024-11-20 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 2024-11-22 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 2024-11-20 DELIVER IN PERSON AIR Quick delivery required N O 2024-11-12
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care R F 2024-11-13
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 2024-11-22 NONE SHIP Fragile item A P 2024-11-14
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_date WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_date
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_date
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date order by l_orderkey;")
|
||||
-- result:
|
||||
test_date
|
||||
-- !result
|
||||
|
|
@ -82,77 +169,23 @@ SELECT count(*) FROM test_date;
|
|||
-- !result
|
||||
SELECT * FROM test_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 2024-11-22 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care R F 2024-11-13
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 2024-11-22 NONE SHIP Fragile item A P 2024-11-14
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care R F 2024-11-13
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 2024-11-22 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care R F 2024-11-13
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 2024-11-22 NONE SHIP Fragile item A P 2024-11-14
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 2024-11-15 2024-11-20 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 2024-11-22 NONE SHIP Fragile item
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_date;
|
||||
-- result:
|
||||
-- !result
|
||||
CREATE MATERIALIZED VIEW test_date
|
||||
PARTITION BY (l_returnflag, l_linestatus, l_shipdate)
|
||||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES (
|
||||
"replication_num" = "1",
|
||||
"transparent_mv_rewrite_mode" = "true"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date;
|
||||
-- result:
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_date PARTITION (('R', 'F', '2024-11-13 00:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
SELECT count(*) FROM test_date;
|
||||
-- result:
|
||||
3
|
||||
-- !result
|
||||
SELECT * FROM test_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care
|
||||
-- !result
|
||||
SELECT * FROM test_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 2024-11-22 NONE SHIP Fragile item
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_date WITH SYNC MODE;
|
||||
SELECT count(*) FROM test_date;
|
||||
-- result:
|
||||
3
|
||||
-- !result
|
||||
SELECT * FROM test_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care
|
||||
-- !result
|
||||
SELECT * FROM test_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 2024-11-22 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 2024-11-20 DELIVER IN PERSON AIR Quick delivery required N O 2024-11-12
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 2024-11-21 TAKE BACK RETURN RAIL Handle with care R F 2024-11-13
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 2024-11-22 NONE SHIP Fragile item A P 2024-11-14
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_date;
|
||||
-- result:
|
||||
|
|
@ -162,19 +195,19 @@ PARTITION BY (l_returnflag, l_linestatus, date_trunc('hour', l_shipdate))
|
|||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES ("replication_num" = "1")
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours;
|
||||
-- result:
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_hours PARTITION (('R', 'F', '2024-11-13 00:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_hours
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_hours
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours order by l_orderkey;")
|
||||
-- result:
|
||||
test_hours
|
||||
-- !result
|
||||
|
|
@ -184,33 +217,33 @@ SELECT count(*) FROM test_hours;
|
|||
-- !result
|
||||
SELECT * FROM test_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 00:00:00 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_hours WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_hours
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_hours
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours order by l_orderkey;")
|
||||
-- result:
|
||||
test_hours
|
||||
-- !result
|
||||
|
|
@ -220,23 +253,23 @@ SELECT count(*) FROM test_hours;
|
|||
-- !result
|
||||
SELECT * FROM test_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 00:00:00 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_hours;
|
||||
-- result:
|
||||
|
|
@ -249,19 +282,23 @@ PROPERTIES (
|
|||
"transparent_mv_rewrite_mode" = "true"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours;
|
||||
-- result:
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_hours PARTITION (('R', 'F', '2024-11-13 00:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
select sleep(3);
|
||||
-- result:
|
||||
1
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_hours
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_hours
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours order by l_orderkey;")
|
||||
-- result:
|
||||
test_hours
|
||||
-- !result
|
||||
|
|
@ -271,12 +308,12 @@ SELECT count(*) FROM test_hours;
|
|||
-- !result
|
||||
SELECT * FROM test_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM test_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_hours WITH SYNC MODE;
|
||||
SELECT count(*) FROM test_hours;
|
||||
|
|
@ -285,19 +322,28 @@ SELECT count(*) FROM test_hours;
|
|||
-- !result
|
||||
SELECT * FROM test_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM test_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_hours;
|
||||
-- result:
|
||||
-- !result
|
||||
drop database db_${uuid0} force;
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours;
|
||||
-- result:
|
||||
-- !result
|
||||
drop catalog mv_iceberg_${uuid0};
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date;
|
||||
-- result:
|
||||
-- !result
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.t1;
|
||||
-- result:
|
||||
-- !result
|
||||
drop database mv_iceberg_${uuid0}.sql_test_db_${uuid0} force;
|
||||
-- result:
|
||||
-- !result
|
||||
drop database db_${uuid0} force;
|
||||
-- result:
|
||||
-- !result
|
||||
|
|
@ -2,12 +2,6 @@
|
|||
set new_planner_optimize_timeout=10000;
|
||||
-- result:
|
||||
-- !result
|
||||
create database db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
use db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
create external catalog mv_iceberg_${uuid0}
|
||||
properties
|
||||
(
|
||||
|
|
@ -17,57 +11,172 @@ properties
|
|||
);
|
||||
-- result:
|
||||
-- !result
|
||||
set catalog mv_iceberg_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
create database sql_test_db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
use sql_test_db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
CREATE TABLE t1 (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1),
|
||||
l_shipdate STRING,
|
||||
l_commitdate STRING,
|
||||
l_receiptdate STRING,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44)
|
||||
);
|
||||
-- result:
|
||||
-- !result
|
||||
INSERT INTO t1 VALUES( 1, 1001, 5001, 1, 10.00, 1000.00, 0.05, 0.08, 'N', 'O', '2024-11-12', '2024-11-15', '2024-11-20', 'DELIVER IN PERSON', 'AIR', 'Quick delivery required');
|
||||
-- result:
|
||||
-- !result
|
||||
INSERT INTO t1 VALUES (2, 1002, 5002, 2, 20.00, 2000.00, 0.10, 0.15, 'R', 'F', '2024-11-13', '2024-11-16', '2024-11-21', 'TAKE BACK RETURN', 'RAIL', 'Handle with care');
|
||||
-- result:
|
||||
-- !result
|
||||
INSERT INTO t1 VALUES (3, 1003, 5003, 3, 30.00, 3000.00, 0.15, 0.20, 'A', 'P', '2024-11-14', '2024-11-17', '2024-11-22', 'NONE', 'SHIP', 'Fragile item');
|
||||
-- result:
|
||||
-- !result
|
||||
CREATE TABLE lineitem_days (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_commitdate DATETIME,
|
||||
l_receiptdate DATETIME,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44),
|
||||
l_shipdate DATETIME,
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1)
|
||||
) PARTITION BY day(l_shipdate), l_returnflag, l_linestatus;
|
||||
-- result:
|
||||
-- !result
|
||||
INSERT INTO lineitem_days SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment, l_shipdate, l_returnflag, l_linestatus FROM t1;
|
||||
-- result:
|
||||
-- !result
|
||||
CREATE TABLE lineitem_months (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_commitdate DATETIME,
|
||||
l_receiptdate DATETIME,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44),
|
||||
l_shipdate DATETIME,
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1)
|
||||
) PARTITION BY month(l_shipdate), l_returnflag, l_linestatus;
|
||||
-- result:
|
||||
-- !result
|
||||
INSERT INTO lineitem_months SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment, l_shipdate, l_returnflag, l_linestatus FROM t1;
|
||||
-- result:
|
||||
-- !result
|
||||
CREATE TABLE lineitem_years (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_commitdate DATETIME,
|
||||
l_receiptdate DATETIME,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44),
|
||||
l_shipdate DATETIME,
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1)
|
||||
) PARTITION BY year(l_shipdate), l_returnflag, l_linestatus;
|
||||
-- result:
|
||||
-- !result
|
||||
INSERT INTO lineitem_years SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment, l_shipdate, l_returnflag, l_linestatus FROM t1;
|
||||
-- result:
|
||||
-- !result
|
||||
set catalog default_catalog;
|
||||
-- result:
|
||||
-- !result
|
||||
create database db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
use db_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
CREATE MATERIALIZED VIEW test_days
|
||||
PARTITION BY (l_returnflag, l_linestatus, date_trunc('day', l_shipdate))
|
||||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES ("replication_num" = "1")
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days;
|
||||
-- result:
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_days PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
|
||||
-- !result
|
||||
SELECT count(*) FROM test_days;
|
||||
-- result:
|
||||
1
|
||||
0
|
||||
-- !result
|
||||
SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 00:00:00 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_days WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days order by l_orderkey;")
|
||||
|
|
@ -78,15 +187,15 @@ function: print_hit_materialized_views("SELECT * FROM test_days where l_shipdate
|
|||
-- result:
|
||||
test_days
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
-- !result
|
||||
|
|
@ -96,23 +205,23 @@ SELECT count(*) FROM test_days;
|
|||
-- !result
|
||||
SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 00:00:00 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_days;
|
||||
-- result:
|
||||
|
|
@ -125,29 +234,29 @@ PROPERTIES (
|
|||
"transparent_mv_rewrite_mode" = "true"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days;
|
||||
-- result:
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_days PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
|
||||
-- !result
|
||||
SELECT count(*) FROM test_days;
|
||||
-- result:
|
||||
|
|
@ -155,12 +264,12 @@ SELECT count(*) FROM test_days;
|
|||
-- !result
|
||||
SELECT * FROM test_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_days WITH SYNC MODE;
|
||||
SELECT count(*) FROM test_days;
|
||||
|
|
@ -169,12 +278,12 @@ SELECT count(*) FROM test_days;
|
|||
-- !result
|
||||
SELECT * FROM test_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_days;
|
||||
-- result:
|
||||
|
|
@ -187,7 +296,7 @@ PROPERTIES (
|
|||
"partition_retention_condition" = "date_trunc('day', l_shipdate) >= '2024-11-13'"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days;
|
||||
-- result:
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_days PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
|
|
@ -199,15 +308,15 @@ function: print_hit_materialized_views("SELECT * FROM test_days where l_shipdate
|
|||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
|
|
@ -218,20 +327,20 @@ SELECT count(*) FROM test_days;
|
|||
SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 00:00:00 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_days WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days order by l_orderkey;")
|
||||
|
|
@ -242,54 +351,51 @@ function: print_hit_materialized_views("SELECT * FROM test_days where l_shipdate
|
|||
-- result:
|
||||
test_days
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;")
|
||||
-- result:
|
||||
test_days
|
||||
-- !result
|
||||
SELECT count(*) FROM test_days;
|
||||
-- result:
|
||||
1
|
||||
2
|
||||
-- !result
|
||||
SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 00:00:00 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 00:00:00 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 00:00:00 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_days;
|
||||
-- result:
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_days;
|
||||
-- result:
|
||||
E: (1064, 'Materialized view test_days is not found')
|
||||
-- !result
|
||||
CREATE MATERIALIZED VIEW test_months
|
||||
PARTITION BY (l_returnflag, l_linestatus, date_trunc('month', l_shipdate))
|
||||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES ("replication_num" = "1")
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months;
|
||||
-- result:
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_months PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
|
|
@ -301,15 +407,15 @@ function: print_hit_materialized_views("SELECT * FROM test_months where l_shipda
|
|||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
|
|
@ -320,20 +426,20 @@ SELECT count(*) FROM test_months;
|
|||
SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_months WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_months order by l_orderkey;")
|
||||
|
|
@ -344,15 +450,15 @@ function: print_hit_materialized_views("SELECT * FROM test_months where l_shipda
|
|||
-- result:
|
||||
test_months
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_months
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_months
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months order by l_orderkey;")
|
||||
-- result:
|
||||
test_months
|
||||
-- !result
|
||||
|
|
@ -362,97 +468,23 @@ SELECT count(*) FROM test_months;
|
|||
-- !result
|
||||
SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_months;
|
||||
-- result:
|
||||
-- !result
|
||||
CREATE MATERIALIZED VIEW test_months
|
||||
PARTITION BY (l_returnflag, l_linestatus, date_trunc('month', l_shipdate))
|
||||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES (
|
||||
"replication_num" = "1",
|
||||
"transparent_mv_rewrite_mode" = "true"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months;
|
||||
-- result:
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_months PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_months order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
SELECT count(*) FROM test_months;
|
||||
-- result:
|
||||
3
|
||||
-- !result
|
||||
SELECT * FROM test_months order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
-- !result
|
||||
SELECT * FROM test_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
-- !result
|
||||
SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_months WITH SYNC MODE;
|
||||
SELECT count(*) FROM test_months;
|
||||
-- result:
|
||||
3
|
||||
-- !result
|
||||
SELECT * FROM test_months order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
-- !result
|
||||
SELECT * FROM test_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
-- !result
|
||||
SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_months;
|
||||
-- result:
|
||||
|
|
@ -462,7 +494,7 @@ PARTITION BY (l_returnflag, l_linestatus, date_trunc('year', l_shipdate))
|
|||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES ("replication_num" = "1")
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years;
|
||||
-- result:
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_years PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
|
|
@ -474,15 +506,15 @@ function: print_hit_materialized_views("SELECT * FROM test_years where l_shipdat
|
|||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
|
|
@ -493,20 +525,20 @@ SELECT count(*) FROM test_years;
|
|||
SELECT * FROM test_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_years WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_years order by l_orderkey;")
|
||||
|
|
@ -517,15 +549,15 @@ function: print_hit_materialized_views("SELECT * FROM test_years where l_shipdat
|
|||
-- result:
|
||||
test_years
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_years
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
test_years
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years order by l_orderkey;")
|
||||
-- result:
|
||||
test_years
|
||||
-- !result
|
||||
|
|
@ -535,23 +567,23 @@ SELECT count(*) FROM test_years;
|
|||
-- !result
|
||||
SELECT * FROM test_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_years;
|
||||
-- result:
|
||||
|
|
@ -564,10 +596,14 @@ PROPERTIES (
|
|||
"transparent_mv_rewrite_mode" = "true"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years;
|
||||
-- result:
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_years PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
select sleep(3);
|
||||
-- result:
|
||||
1
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM test_years order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
|
|
@ -576,15 +612,15 @@ function: print_hit_materialized_views("SELECT * FROM test_years where l_shipdat
|
|||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years order by l_orderkey;")
|
||||
-- result:
|
||||
|
||||
-- !result
|
||||
|
|
@ -594,18 +630,18 @@ SELECT count(*) FROM test_years;
|
|||
-- !result
|
||||
SELECT * FROM test_years order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM test_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM test_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
REFRESH MATERIALIZED VIEW test_years WITH SYNC MODE;
|
||||
SELECT count(*) FROM test_years;
|
||||
|
|
@ -614,25 +650,37 @@ SELECT count(*) FROM test_years;
|
|||
-- !result
|
||||
SELECT * FROM test_years order by l_orderkey;
|
||||
-- result:
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 N O 2024-11-12 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
1 1001 5001 1 10.00 1000.00 0.05 0.08 2024-11-15 00:00:00 2024-11-20 00:00:00 DELIVER IN PERSON AIR Quick delivery required 2024-11-12 00:00:00 N O
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
SELECT * FROM test_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
-- !result
|
||||
SELECT * FROM test_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
-- result:
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 R F 2024-11-13 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 A P 2024-11-14 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item
|
||||
2 1002 5002 2 20.00 2000.00 0.10 0.15 2024-11-16 00:00:00 2024-11-21 00:00:00 TAKE BACK RETURN RAIL Handle with care 2024-11-13 00:00:00 R F
|
||||
3 1003 5003 3 30.00 3000.00 0.15 0.20 2024-11-17 00:00:00 2024-11-22 00:00:00 NONE SHIP Fragile item 2024-11-14 00:00:00 A P
|
||||
-- !result
|
||||
DROP MATERIALIZED VIEW test_years;
|
||||
-- result:
|
||||
-- !result
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days;
|
||||
-- result:
|
||||
-- !result
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months;
|
||||
-- result:
|
||||
-- !result
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years;
|
||||
-- result:
|
||||
-- !result
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.t1;
|
||||
-- result:
|
||||
-- !result
|
||||
drop database mv_iceberg_${uuid0}.sql_test_db_${uuid0} force;
|
||||
-- result:
|
||||
-- !result
|
||||
drop database db_${uuid0} force;
|
||||
-- result:
|
||||
-- !result
|
||||
drop catalog mv_iceberg_${uuid0};
|
||||
-- result:
|
||||
-- !result
|
||||
|
|
@ -1,146 +1,7 @@
|
|||
-- name: test_mv_with_multi_partition_columns_iceberg1 @slow
|
||||
|
||||
-- !!!! SCIPRTS: prepare iceberg table before tests !!!!
|
||||
-- CREATE DATABASE sql_test_db;
|
||||
-- use sql_test_db;
|
||||
-- CREATE TABLES IN ICEBERG + SPARK
|
||||
-- CREATE TABLE t1 (
|
||||
-- l_orderkey BIGINT,
|
||||
-- l_partkey INT,
|
||||
-- l_suppkey INT,
|
||||
-- l_linenumber INT,
|
||||
-- l_quantity DECIMAL(15, 2),
|
||||
-- l_extendedprice DECIMAL(15, 2),
|
||||
-- l_discount DECIMAL(15, 2),
|
||||
-- l_tax DECIMAL(15, 2),
|
||||
-- l_returnflag VARCHAR(1),
|
||||
-- l_linestatus VARCHAR(1),
|
||||
-- l_shipdate STRING,
|
||||
-- l_commitdate STRING,
|
||||
-- l_receiptdate STRING,
|
||||
-- l_shipinstruct VARCHAR(25),
|
||||
-- l_shipmode VARCHAR(10),
|
||||
-- l_comment VARCHAR(44)
|
||||
-- ) USING ICEBERG
|
||||
-- PARTITIONED BY (l_returnflag, l_linestatus);
|
||||
|
||||
-- INSERT INTO t1 VALUES( 1, 1001, 5001, 1, 10.00, 1000.00, 0.05, 0.08, 'N', 'O', '2024-11-12', '2024-11-15', '2024-11-20', 'DELIVER IN PERSON', 'AIR', 'Quick delivery required');
|
||||
-- INSERT INTO t1 VALUES (2, 1002, 5002, 2, 20.00, 2000.00, 0.10, 0.15, 'R', 'F', '2024-11-13', '2024-11-16', '2024-11-21', 'TAKE BACK RETURN', 'RAIL', 'Handle with care');
|
||||
-- INSERT INTO t1 VALUES (3, 1003, 5003, 3, 30.00, 3000.00, 0.15, 0.20, 'A', 'P', '2024-11-14', '2024-11-17', '2024-11-22', 'NONE', 'SHIP', 'Fragile item');
|
||||
|
||||
-- CREATE TABLE lineitem_date (
|
||||
-- l_orderkey BIGINT,
|
||||
-- l_partkey INT,
|
||||
-- l_suppkey INT,
|
||||
-- l_linenumber INT,
|
||||
-- l_quantity DECIMAL(15, 2),
|
||||
-- l_extendedprice DECIMAL(15, 2),
|
||||
-- l_discount DECIMAL(15, 2),
|
||||
-- l_tax DECIMAL(15, 2),
|
||||
-- l_returnflag VARCHAR(1),
|
||||
-- l_linestatus VARCHAR(1),
|
||||
-- l_shipdate DATE,
|
||||
-- l_commitdate DATE,
|
||||
-- l_receiptdate DATE,
|
||||
-- l_shipinstruct VARCHAR(25),
|
||||
-- l_shipmode VARCHAR(10),
|
||||
-- l_comment VARCHAR(44)
|
||||
-- ) USING ICEBERG
|
||||
-- PARTITIONED BY (l_returnflag, l_linestatus, l_shipdate);
|
||||
-- INSERT INTO lineitem_date SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, to_date(l_shipdate), to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment FROM t1;
|
||||
|
||||
-- CREATE TABLE lineitem_hours (
|
||||
-- l_orderkey BIGINT,
|
||||
-- l_partkey INT,
|
||||
-- l_suppkey INT,
|
||||
-- l_linenumber INT,
|
||||
-- l_quantity DECIMAL(15, 2),
|
||||
-- l_extendedprice DECIMAL(15, 2),
|
||||
-- l_discount DECIMAL(15, 2),
|
||||
-- l_tax DECIMAL(15, 2),
|
||||
-- l_returnflag VARCHAR(1),
|
||||
-- l_linestatus VARCHAR(1),
|
||||
-- l_shipdate TIMESTAMP,
|
||||
-- l_commitdate TIMESTAMP,
|
||||
-- l_receiptdate TIMESTAMP,
|
||||
-- l_shipinstruct VARCHAR(25),
|
||||
-- l_shipmode VARCHAR(10),
|
||||
-- l_comment VARCHAR(44)
|
||||
-- ) USING ICEBERG
|
||||
-- PARTITIONED BY (l_returnflag, l_linestatus, hours(l_shipdate));
|
||||
-- INSERT INTO lineitem_hours SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, to_date(l_shipdate), to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment FROM t1;
|
||||
|
||||
|
||||
-- CREATE TABLE lineitem_days (
|
||||
-- l_orderkey BIGINT,
|
||||
-- l_partkey INT,
|
||||
-- l_suppkey INT,
|
||||
-- l_linenumber INT,
|
||||
-- l_quantity DECIMAL(15, 2),
|
||||
-- l_extendedprice DECIMAL(15, 2),
|
||||
-- l_discount DECIMAL(15, 2),
|
||||
-- l_tax DECIMAL(15, 2),
|
||||
-- l_returnflag VARCHAR(1),
|
||||
-- l_linestatus VARCHAR(1),
|
||||
-- l_shipdate TIMESTAMP,
|
||||
-- l_commitdate TIMESTAMP,
|
||||
-- l_receiptdate TIMESTAMP,
|
||||
-- l_shipinstruct VARCHAR(25),
|
||||
-- l_shipmode VARCHAR(10),
|
||||
-- l_comment VARCHAR(44)
|
||||
-- ) USING ICEBERG
|
||||
-- PARTITIONED BY (l_returnflag, l_linestatus, days(l_shipdate));
|
||||
-- INSERT INTO lineitem_days SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, to_date(l_shipdate), to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment FROM t1;
|
||||
|
||||
-- CREATE TABLE lineitem_months (
|
||||
-- l_orderkey BIGINT,
|
||||
-- l_partkey INT,
|
||||
-- l_suppkey INT,
|
||||
-- l_linenumber INT,
|
||||
-- l_quantity DECIMAL(15, 2),
|
||||
-- l_extendedprice DECIMAL(15, 2),
|
||||
-- l_discount DECIMAL(15, 2),
|
||||
-- l_tax DECIMAL(15, 2),
|
||||
-- l_returnflag VARCHAR(1),
|
||||
-- l_linestatus VARCHAR(1),
|
||||
-- l_shipdate DATE,
|
||||
-- l_commitdate TIMESTAMP,
|
||||
-- l_receiptdate TIMESTAMP,
|
||||
-- l_shipinstruct VARCHAR(25),
|
||||
-- l_shipmode VARCHAR(10),
|
||||
-- l_comment VARCHAR(44)
|
||||
-- ) USING ICEBERG
|
||||
-- PARTITIONED BY (l_returnflag, l_linestatus, months(l_shipdate));
|
||||
-- INSERT INTO lineitem_months SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, to_date(l_shipdate), to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment FROM t1;
|
||||
|
||||
|
||||
-- CREATE TABLE lineitem_years (
|
||||
-- l_orderkey BIGINT,
|
||||
-- l_partkey INT,
|
||||
-- l_suppkey INT,
|
||||
-- l_linenumber INT,
|
||||
-- l_quantity DECIMAL(15, 2),
|
||||
-- l_extendedprice DECIMAL(15, 2),
|
||||
-- l_discount DECIMAL(15, 2),
|
||||
-- l_tax DECIMAL(15, 2),
|
||||
-- l_returnflag VARCHAR(1),
|
||||
-- l_linestatus VARCHAR(1),
|
||||
-- l_shipdate DATE,
|
||||
-- l_commitdate TIMESTAMP,
|
||||
-- l_receiptdate TIMESTAMP,
|
||||
-- l_shipinstruct VARCHAR(25),
|
||||
-- l_shipmode VARCHAR(10),
|
||||
-- l_comment VARCHAR(44)
|
||||
-- ) USING ICEBERG
|
||||
-- PARTITIONED BY (l_returnflag, l_linestatus, years(l_shipdate));
|
||||
-- INSERT INTO lineitem_years SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, to_date(l_shipdate), to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment FROM t1;
|
||||
|
||||
set new_planner_optimize_timeout=10000;
|
||||
|
||||
-- create mv
|
||||
create database db_${uuid0};
|
||||
use db_${uuid0};
|
||||
|
||||
create external catalog mv_iceberg_${uuid0}
|
||||
properties
|
||||
(
|
||||
|
|
@ -148,7 +9,78 @@ properties
|
|||
"iceberg.catalog.type" = "hive",
|
||||
"hive.metastore.uris" = "${iceberg_catalog_hive_metastore_uris}"
|
||||
);
|
||||
set catalog mv_iceberg_${uuid0};
|
||||
create database sql_test_db_${uuid0};
|
||||
use sql_test_db_${uuid0};
|
||||
|
||||
CREATE TABLE t1 (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1),
|
||||
l_shipdate STRING,
|
||||
l_commitdate STRING,
|
||||
l_receiptdate STRING,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES( 1, 1001, 5001, 1, 10.00, 1000.00, 0.05, 0.08, 'N', 'O', '2024-11-12', '2024-11-15', '2024-11-20', 'DELIVER IN PERSON', 'AIR', 'Quick delivery required');
|
||||
INSERT INTO t1 VALUES (2, 1002, 5002, 2, 20.00, 2000.00, 0.10, 0.15, 'R', 'F', '2024-11-13', '2024-11-16', '2024-11-21', 'TAKE BACK RETURN', 'RAIL', 'Handle with care');
|
||||
INSERT INTO t1 VALUES (3, 1003, 5003, 3, 30.00, 3000.00, 0.15, 0.20, 'A', 'P', '2024-11-14', '2024-11-17', '2024-11-22', 'NONE', 'SHIP', 'Fragile item');
|
||||
|
||||
CREATE TABLE lineitem_date (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_commitdate DATE,
|
||||
l_receiptdate DATE,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44),
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1),
|
||||
l_shipdate DATE
|
||||
) PARTITION BY (l_returnflag, l_linestatus, l_shipdate);
|
||||
INSERT INTO lineitem_date SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment, l_returnflag, l_linestatus, to_date(l_shipdate) FROM t1;
|
||||
|
||||
CREATE TABLE lineitem_hours (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_commitdate DATETIME,
|
||||
l_receiptdate DATETIME,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44),
|
||||
l_shipdate DATETIME,
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1)
|
||||
) PARTITION BY hour(l_shipdate), l_returnflag, l_linestatus;
|
||||
|
||||
INSERT INTO lineitem_hours SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment, l_shipdate, l_returnflag, l_linestatus FROM t1;
|
||||
|
||||
set catalog default_catalog;
|
||||
-- create mv
|
||||
create database db_${uuid0};
|
||||
use db_${uuid0};
|
||||
|
||||
set materialized_view_rewrite_mode='force';
|
||||
-------------------------------- IDENTITY --------------------------------
|
||||
|
|
@ -157,51 +89,27 @@ PARTITION BY (l_returnflag, l_linestatus, l_shipdate)
|
|||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES ("replication_num" = "1")
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_date PARTITION (('R', 'F', '2024-11-13 00:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date order by l_orderkey;")
|
||||
SELECT count(*) FROM test_date;
|
||||
SELECT * FROM test_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date order by l_orderkey;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_date WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date order by l_orderkey;")
|
||||
SELECT count(*) FROM test_date;
|
||||
SELECT * FROM test_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date order by l_orderkey;
|
||||
DROP MATERIALIZED VIEW test_date;
|
||||
|
||||
CREATE MATERIALIZED VIEW test_date
|
||||
PARTITION BY (l_returnflag, l_linestatus, l_shipdate)
|
||||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES (
|
||||
"replication_num" = "1",
|
||||
"transparent_mv_rewrite_mode" = "true"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_date PARTITION (('R', 'F', '2024-11-13 00:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_date order by l_orderkey;")
|
||||
SELECT count(*) FROM test_date;
|
||||
SELECT * FROM test_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM test_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
REFRESH MATERIALIZED VIEW test_date WITH SYNC MODE;
|
||||
SELECT count(*) FROM test_date;
|
||||
SELECT * FROM test_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM test_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date order by l_orderkey;
|
||||
DROP MATERIALIZED VIEW test_date;
|
||||
|
||||
-------------------------------- HOURS --------------------------------
|
||||
|
|
@ -210,27 +118,27 @@ PARTITION BY (l_returnflag, l_linestatus, date_trunc('hour', l_shipdate))
|
|||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES ("replication_num" = "1")
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_hours PARTITION (('R', 'F', '2024-11-13 00:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours order by l_orderkey;")
|
||||
SELECT count(*) FROM test_hours;
|
||||
SELECT * FROM test_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours order by l_orderkey;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_hours WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours order by l_orderkey;")
|
||||
SELECT count(*) FROM test_hours;
|
||||
SELECT * FROM test_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours order by l_orderkey;
|
||||
DROP MATERIALIZED VIEW test_hours;
|
||||
|
||||
CREATE MATERIALIZED VIEW test_hours
|
||||
|
|
@ -241,12 +149,14 @@ PROPERTIES (
|
|||
"transparent_mv_rewrite_mode" = "true"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_hours PARTITION (('R', 'F', '2024-11-13 00:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_hours order by l_orderkey;")
|
||||
select sleep(3);
|
||||
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours order by l_orderkey;")
|
||||
SELECT count(*) FROM test_hours;
|
||||
SELECT * FROM test_hours where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM test_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
|
|
@ -257,6 +167,9 @@ SELECT * FROM test_hours where l_shipdate >= '2024-11-13 00:00:00' order by l_or
|
|||
|
||||
DROP MATERIALIZED VIEW test_hours;
|
||||
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_hours;
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_date;
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.t1;
|
||||
drop database mv_iceberg_${uuid0}.sql_test_db_${uuid0} force;
|
||||
|
||||
drop database db_${uuid0} force;
|
||||
drop catalog mv_iceberg_${uuid0};
|
||||
drop database db_${uuid0} force;
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
-- name: test_mv_with_multi_partition_columns_iceberg2 @slow
|
||||
|
||||
set new_planner_optimize_timeout=10000;
|
||||
-- create mv
|
||||
create database db_${uuid0};
|
||||
use db_${uuid0};
|
||||
|
||||
create external catalog mv_iceberg_${uuid0}
|
||||
properties
|
||||
|
|
@ -12,6 +9,99 @@ properties
|
|||
"iceberg.catalog.type" = "hive",
|
||||
"hive.metastore.uris" = "${iceberg_catalog_hive_metastore_uris}"
|
||||
);
|
||||
set catalog mv_iceberg_${uuid0};
|
||||
|
||||
create database sql_test_db_${uuid0};
|
||||
use sql_test_db_${uuid0};
|
||||
|
||||
CREATE TABLE t1 (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1),
|
||||
l_shipdate STRING,
|
||||
l_commitdate STRING,
|
||||
l_receiptdate STRING,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES( 1, 1001, 5001, 1, 10.00, 1000.00, 0.05, 0.08, 'N', 'O', '2024-11-12', '2024-11-15', '2024-11-20', 'DELIVER IN PERSON', 'AIR', 'Quick delivery required');
|
||||
INSERT INTO t1 VALUES (2, 1002, 5002, 2, 20.00, 2000.00, 0.10, 0.15, 'R', 'F', '2024-11-13', '2024-11-16', '2024-11-21', 'TAKE BACK RETURN', 'RAIL', 'Handle with care');
|
||||
INSERT INTO t1 VALUES (3, 1003, 5003, 3, 30.00, 3000.00, 0.15, 0.20, 'A', 'P', '2024-11-14', '2024-11-17', '2024-11-22', 'NONE', 'SHIP', 'Fragile item');
|
||||
|
||||
CREATE TABLE lineitem_days (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_commitdate DATETIME,
|
||||
l_receiptdate DATETIME,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44),
|
||||
l_shipdate DATETIME,
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1)
|
||||
) PARTITION BY day(l_shipdate), l_returnflag, l_linestatus;
|
||||
INSERT INTO lineitem_days SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment, l_shipdate, l_returnflag, l_linestatus FROM t1;
|
||||
|
||||
CREATE TABLE lineitem_months (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_commitdate DATETIME,
|
||||
l_receiptdate DATETIME,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44),
|
||||
l_shipdate DATETIME,
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1)
|
||||
) PARTITION BY month(l_shipdate), l_returnflag, l_linestatus;
|
||||
INSERT INTO lineitem_months SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment, l_shipdate, l_returnflag, l_linestatus FROM t1;
|
||||
|
||||
|
||||
CREATE TABLE lineitem_years (
|
||||
l_orderkey BIGINT,
|
||||
l_partkey INT,
|
||||
l_suppkey INT,
|
||||
l_linenumber INT,
|
||||
l_quantity DECIMAL(15, 2),
|
||||
l_extendedprice DECIMAL(15, 2),
|
||||
l_discount DECIMAL(15, 2),
|
||||
l_tax DECIMAL(15, 2),
|
||||
l_commitdate DATETIME,
|
||||
l_receiptdate DATETIME,
|
||||
l_shipinstruct VARCHAR(25),
|
||||
l_shipmode VARCHAR(10),
|
||||
l_comment VARCHAR(44),
|
||||
l_shipdate DATETIME,
|
||||
l_returnflag VARCHAR(1),
|
||||
l_linestatus VARCHAR(1)
|
||||
) PARTITION BY year(l_shipdate), l_returnflag, l_linestatus;
|
||||
INSERT INTO lineitem_years SELECT l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, to_date(l_commitdate), to_date(l_receiptdate), l_shipinstruct, l_shipmode, l_comment, l_shipdate, l_returnflag, l_linestatus FROM t1;
|
||||
|
||||
set catalog default_catalog;
|
||||
-- create mv
|
||||
create database db_${uuid0};
|
||||
use db_${uuid0};
|
||||
|
||||
-------------------------------- DAYS --------------------------------
|
||||
CREATE MATERIALIZED VIEW test_days
|
||||
|
|
@ -19,31 +109,31 @@ PARTITION BY (l_returnflag, l_linestatus, date_trunc('day', l_shipdate))
|
|||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES ("replication_num" = "1")
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_days PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;")
|
||||
SELECT count(*) FROM test_days;
|
||||
SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_days WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;")
|
||||
SELECT count(*) FROM test_days;
|
||||
SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;
|
||||
DROP MATERIALIZED VIEW test_days;
|
||||
|
||||
CREATE MATERIALIZED VIEW test_days
|
||||
|
|
@ -54,14 +144,14 @@ PROPERTIES (
|
|||
"transparent_mv_rewrite_mode" = "true"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_days PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;")
|
||||
SELECT count(*) FROM test_days;
|
||||
SELECT * FROM test_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
|
|
@ -81,33 +171,31 @@ PROPERTIES (
|
|||
"partition_retention_condition" = "date_trunc('day', l_shipdate) >= '2024-11-13'"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_days PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;")
|
||||
SELECT count(*) FROM test_days;
|
||||
SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_days WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;")
|
||||
SELECT count(*) FROM test_days;
|
||||
SELECT * FROM test_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_days order by l_orderkey;
|
||||
DROP MATERIALIZED VIEW test_days;
|
||||
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days order by l_orderkey;
|
||||
DROP MATERIALIZED VIEW test_days;
|
||||
-------------------------------- MONTHS --------------------------------
|
||||
CREATE MATERIALIZED VIEW test_months
|
||||
|
|
@ -115,59 +203,31 @@ PARTITION BY (l_returnflag, l_linestatus, date_trunc('month', l_shipdate))
|
|||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES ("replication_num" = "1")
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_months PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_months order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months order by l_orderkey;")
|
||||
SELECT count(*) FROM test_months;
|
||||
SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months order by l_orderkey;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_months WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_months order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months order by l_orderkey;")
|
||||
SELECT count(*) FROM test_months;
|
||||
SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months order by l_orderkey;
|
||||
DROP MATERIALIZED VIEW test_months;
|
||||
|
||||
CREATE MATERIALIZED VIEW test_months
|
||||
PARTITION BY (l_returnflag, l_linestatus, date_trunc('month', l_shipdate))
|
||||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES (
|
||||
"replication_num" = "1",
|
||||
"transparent_mv_rewrite_mode" = "true"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_months PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_months order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_months order by l_orderkey;")
|
||||
SELECT count(*) FROM test_months;
|
||||
SELECT * FROM test_months order by l_orderkey;
|
||||
SELECT * FROM test_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
REFRESH MATERIALIZED VIEW test_months WITH SYNC MODE;
|
||||
SELECT count(*) FROM test_months;
|
||||
SELECT * FROM test_months order by l_orderkey;
|
||||
SELECT * FROM test_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM test_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months order by l_orderkey;
|
||||
DROP MATERIALIZED VIEW test_months;
|
||||
|
||||
-------------------------------- YEARS --------------------------------
|
||||
|
|
@ -176,31 +236,31 @@ PARTITION BY (l_returnflag, l_linestatus, date_trunc('year', l_shipdate))
|
|||
REFRESH DEFERRED MANUAL
|
||||
PROPERTIES ("replication_num" = "1")
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_years PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_years order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM test_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years order by l_orderkey;")
|
||||
SELECT count(*) FROM test_years;
|
||||
SELECT * FROM test_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years order by l_orderkey;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_years WITH SYNC MODE;
|
||||
function: print_hit_materialized_views("SELECT * FROM test_years order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM test_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years order by l_orderkey;")
|
||||
SELECT count(*) FROM test_years;
|
||||
SELECT * FROM test_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years order by l_orderkey;
|
||||
DROP MATERIALIZED VIEW test_years;
|
||||
|
||||
CREATE MATERIALIZED VIEW test_years
|
||||
|
|
@ -211,14 +271,15 @@ PROPERTIES (
|
|||
"transparent_mv_rewrite_mode" = "true"
|
||||
)
|
||||
AS
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years;
|
||||
SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years;
|
||||
|
||||
REFRESH MATERIALIZED VIEW test_years PARTITION (('R', 'F', '2024-11-12 08:00:00')) WITH SYNC MODE;
|
||||
select sleep(3);
|
||||
function: print_hit_materialized_views("SELECT * FROM test_years order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM test_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db.lineitem_years order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years where l_shipdate >= '2024-11-13 00:00:00' order by l_orderkey;")
|
||||
function: print_hit_materialized_views("SELECT * FROM mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years order by l_orderkey;")
|
||||
SELECT count(*) FROM test_years;
|
||||
SELECT * FROM test_years order by l_orderkey;
|
||||
SELECT * FROM test_years where l_returnflag = 'R' and l_linestatus = 'F' and l_shipdate = '2024-11-13 00:00:00' order by l_orderkey;
|
||||
|
|
@ -231,5 +292,10 @@ SELECT * FROM test_years where l_shipdate >= '2024-11-13 00:00:00' order by l_or
|
|||
|
||||
DROP MATERIALIZED VIEW test_years;
|
||||
|
||||
drop database db_${uuid0} force;
|
||||
drop catalog mv_iceberg_${uuid0};
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_days;
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_months;
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.lineitem_years;
|
||||
drop table mv_iceberg_${uuid0}.sql_test_db_${uuid0}.t1;
|
||||
drop database mv_iceberg_${uuid0}.sql_test_db_${uuid0} force;
|
||||
|
||||
drop database db_${uuid0} force;
|
||||
|
|
@ -90,6 +90,7 @@ class TestSQLCases(sr_sql_lib.StarrocksSQLApiLib):
|
|||
self.create_starrocks_conn_pool()
|
||||
self.check_cluster_status()
|
||||
self._init_global_configs()
|
||||
self._init_global_session_variables()
|
||||
|
||||
def _init_global_configs(self):
|
||||
"""
|
||||
|
|
@ -105,9 +106,18 @@ class TestSQLCases(sr_sql_lib.StarrocksSQLApiLib):
|
|||
for config in default_configs:
|
||||
sql = "ADMIN SET FRONTEND CONFIG (%s)" % config
|
||||
self.execute_sql(sql)
|
||||
# to avoid partition ttl scheduelr impacting the test result, enlarge the scheduler interval
|
||||
sql = "ADMIN SET FRONTEND CONFIG 'dynamic_partition_check_interval_seconds' = '1200'"
|
||||
self.execute_sql(sql)
|
||||
|
||||
def _init_global_session_variables(self):
|
||||
"""
|
||||
Session variables that are not ready for production but it can be used for testing.
|
||||
"""
|
||||
session_variables = [
|
||||
"new_planner_optimize_timeout = 10000",
|
||||
]
|
||||
for session_variable in session_variables:
|
||||
sql = "SET %s;" % session_variable
|
||||
self.execute_sql(sql)
|
||||
|
||||
|
||||
@sql_annotation.ignore_timeout()
|
||||
def tearDown(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue