[
https://issues.apache.org/jira/browse/HUDI-3197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17471283#comment-17471283
]
Raymond Xu edited comment on HUDI-3197 at 1/9/22, 4:49 AM:
-----------------------------------------------------------
{code:java}
-- create a partitioned, preCombineField-provided cow table
create table hudi_cow_pt_tbl (
id bigint,
name string,
ts bigint,
dt string,
hh string
) using hudi
tblproperties (
type = 'cow',
primaryKey = 'id',
preCombineField = 'ts'
)
partitioned by (dt, hh)
location '/tmp/hudi/hudi_cow_pt_tbl';
-- insert sample data across partitions
insert into hudi_cow_pt_tbl
(id, name, ts, dt, hh)
values
(1, 'foo1', 1000, '20210701', '11'),
(2, 'foo2', 1001, '20210701', '12'),
(3, 'foo3', 1003, '20210701', '13'),
(4, 'foo4', 1004, '20210701', '14');
-- create an external Hudi table
create table hudi_cow_existing_tbl using hudi
partitioned by (dt, hh)
location 'file:///tmp/hudi/hudi_cow_pt_tbl';
-- query with partition pruning
select * from hudi_cow_existing_tbl where dt = '20210701' and hh = '13'; {code}
This validates spark sql created table works with partition pruning
was (Author: xushiyan):
{code:java}
-- create a partitioned, preCombineField-provided cow table
create table hudi_cow_pt_tbl (
id bigint,
name string,
ts bigint,
dt string,
hh string
) using hudi
tblproperties (
type = 'cow',
primaryKey = 'id',
preCombineField = 'ts'
)
partitioned by (dt, hh)
location '/tmp/hudi/hudi_cow_pt_tbl';
-- insert sample data across partitions
insert into hudi_cow_pt_tbl
(id, name, ts, dt, hh)
values
(1, 'foo1', 1000, '20210701', '11'),
(2, 'foo2', 1001, '20210701', '12'),
(3, 'foo3', 1003, '20210701', '13'),
(4, 'foo4', 1004, '20210701', '14');
-- create an external Hudi table
create table hudi_cow_existing_tbl using hudi
partitioned by (dt, hh)
location 'file:///tmp/hudi/hudi_cow_pt_tbl';
-- query with partition pruning
select * from hudi_cow_existing_tbl where dt = '20210701' and hh = '13'; {code}
> Validate partition pruning with Hudi
> ------------------------------------
>
> Key: HUDI-3197
> URL: https://issues.apache.org/jira/browse/HUDI-3197
> Project: Apache Hudi
> Issue Type: Task
> Reporter: Raymond Xu
> Assignee: Raymond Xu
> Priority: Major
> Attachments: Screen Shot 2022-01-08 at 3.22.54 PM.png, Screen Shot
> 2022-01-08 at 3.23.04 PM.png, Screen Shot 2022-01-08 at 3.26.13 PM.png,
> Screen Shot 2022-01-08 at 3.26.53 PM.png
>
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)