forked from apache/gravitino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[apache#4757]feat(trino-connector): Support more partition and sort o…
…rder features of the Iceberg catalog (apache#4925) ### What changes were proposed in this pull request? Support Iceberg partition expressions like: year(x), month(x), day(x), hour(x), bucket(x, n), truncate(x,n) Support Iceberg sort order expressions like: field DESC, field ASC, field DESC NULLS FIRST, field ASC NULLS LAST ### Why are the changes needed? Fix: apache#4757 ### Does this PR introduce _any_ user-facing change? NO ### How was this patch tested? New UTs and ITs
- Loading branch information
Showing
10 changed files
with
776 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 0 additions & 57 deletions
57
...c/test/java/org/apache/gravitino/trino/connector/integration/test/CloseableGroupTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00005_partition_sort_order.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
CREATE SCHEMA gt_db2; | ||
|
||
USE gt_db2; | ||
|
||
CREATE TABLE lineitem( | ||
orderkey bigint, | ||
partkey bigint, | ||
suppkey bigint, | ||
linenumber integer, | ||
quantity decimal(12, 2), | ||
extendedprice decimal(12, 2), | ||
discount decimal(12, 2), | ||
tax decimal(12, 2), | ||
returnflag varchar, | ||
linestatus varchar, | ||
shipdate date, | ||
commitdate date, | ||
receiptdate date, | ||
shipinstruct varchar, | ||
shipmode varchar, | ||
comment varchar | ||
) | ||
WITH ( | ||
partitioning = ARRAY['year(commitdate)'], | ||
sorted_by = ARRAY['partkey', 'extendedprice desc'] | ||
); | ||
|
||
show create table lineitem; | ||
|
||
insert into lineitem select * from tpch.tiny.lineitem; | ||
|
||
select * from lineitem order by orderkey, partkey limit 5; | ||
|
||
CREATE TABLE tb01( | ||
orderkey bigint, | ||
partkey bigint, | ||
suppkey bigint, | ||
linenumber integer, | ||
quantity decimal(12, 2), | ||
extendedprice decimal(12, 2), | ||
discount decimal(12, 2), | ||
tax decimal(12, 2), | ||
returnflag varchar, | ||
linestatus varchar, | ||
shipdate date, | ||
commitdate date, | ||
receiptdate date, | ||
shipinstruct varchar, | ||
shipmode varchar, | ||
comment varchar | ||
) | ||
WITH ( | ||
partitioning = ARRAY['day(commitdate)', 'month(shipdate)', 'bucket(partkey, 2)', 'truncate(shipinstruct, 2)'], | ||
sorted_by = ARRAY['partkey asc nulls last', 'extendedprice DESC NULLS FIRST'] | ||
); | ||
|
||
show create table tb01; | ||
|
||
drop table tb01; | ||
|
||
drop table lineitem; | ||
|
||
drop schema gt_db2; |
71 changes: 71 additions & 0 deletions
71
...test/resources/trino-ci-testset/testsets/lakehouse-iceberg/00005_partition_sort_order.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
CREATE SCHEMA | ||
|
||
USE | ||
|
||
CREATE TABLE | ||
|
||
"CREATE TABLE %.gt_db2.lineitem ( | ||
orderkey bigint, | ||
partkey bigint, | ||
suppkey bigint, | ||
linenumber integer, | ||
quantity decimal(12, 2), | ||
extendedprice decimal(12, 2), | ||
discount decimal(12, 2), | ||
tax decimal(12, 2), | ||
returnflag varchar, | ||
linestatus varchar, | ||
shipdate date, | ||
commitdate date, | ||
receiptdate date, | ||
shipinstruct varchar, | ||
shipmode varchar, | ||
comment varchar | ||
) | ||
COMMENT '' | ||
WITH ( | ||
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/lineitem', | ||
partitioning = ARRAY['year(commitdate)'], | ||
sorted_by = ARRAY['partkey','extendedprice DESC'] | ||
)" | ||
|
||
INSERT: 60175 rows | ||
|
||
"1","22","48","4","28.00","25816.56","0.09","0.06","N","O","1996-04-21","1996-03-30","1996-05-16","NONE","AIR","lites. fluffily even de" | ||
"1","157","10","6","32.00","33828.80","0.07","0.02","N","O","1996-01-30","1996-02-07","1996-02-03","DELIVER IN PERSON","MAIL","arefully slyly ex" | ||
"1","241","23","5","24.00","27389.76","0.10","0.04","N","O","1996-03-30","1996-03-14","1996-04-01","NONE","FOB"," pending foxes. slyly re" | ||
"1","637","38","3","8.00","12301.04","0.10","0.02","N","O","1996-01-29","1996-03-05","1996-01-31","TAKE BACK RETURN","REG AIR","riously. regular, express dep" | ||
"1","674","75","2","36.00","56688.12","0.09","0.06","N","O","1996-04-12","1996-02-28","1996-04-20","TAKE BACK RETURN","MAIL","ly final dependencies: slyly bold " | ||
|
||
CREATE TABLE | ||
|
||
"CREATE TABLE %.gt_db2.tb01 ( | ||
orderkey bigint, | ||
partkey bigint, | ||
suppkey bigint, | ||
linenumber integer, | ||
quantity decimal(12, 2), | ||
extendedprice decimal(12, 2), | ||
discount decimal(12, 2), | ||
tax decimal(12, 2), | ||
returnflag varchar, | ||
linestatus varchar, | ||
shipdate date, | ||
commitdate date, | ||
receiptdate date, | ||
shipinstruct varchar, | ||
shipmode varchar, | ||
comment varchar | ||
) | ||
COMMENT '' | ||
WITH ( | ||
location = 'hdfs://%/user/iceberg/warehouse/TrinoQueryIT/gt_db2%/tb01', | ||
partitioning = ARRAY['day(commitdate)','month(shipdate)','bucket(partkey, 2)','truncate(shipinstruct, 2)'], | ||
sorted_by = ARRAY['partkey ASC NULLS LAST','extendedprice DESC NULLS FIRST'] | ||
)" | ||
|
||
DROP TABLE | ||
|
||
DROP TABLE | ||
|
||
DROP SCHEMA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.