### Initial setup create table tbl1 (val int) partitioned by (id int) stored as parquet; insert into tbl1 partition (id=1) values (111); insert into tbl1 partition (id=2) values (222); ### No analytic functions. Runtime filter is generated. > explain select * from (select tbl1.* from tbl1) a where id in (select id from tbl1 where val>111); Query: explain select * from (select tbl1.* from tbl1) a where id in (select id from tbl1 where val>111) +------------------------------------------------------------------------------------+ | Explain String | +------------------------------------------------------------------------------------+ | Max Per-Host Resource Reservation: Memory=34.00MB | | Per-Host Resource Estimates: Memory=2.06GB | | WARNING: The following tables are missing relevant table and/or column statistics. | | default.tbl1 | | | | PLAN-ROOT SINK | | | | | 04:EXCHANGE [UNPARTITIONED] | | | | | 02:HASH JOIN [LEFT SEMI JOIN, BROADCAST] | | | hash predicates: default.tbl1.id = id | | | runtime filters: RF000 <- id | | | | | |--03:EXCHANGE [BROADCAST] | | | | | | | 01:SCAN HDFS [default.tbl1] | | | partitions=2/2 files=2 size=8B | | | predicates: val > 111 | | | | | 00:SCAN HDFS [default.tbl1] | | partitions=2/2 files=2 size=8B | | runtime filters: RF000 -> default.tbl1.id | +------------------------------------------------------------------------------------+ Fetched 22 row(s) in 0.05s ### Analytic function is added to the subquery. Runtime filter is not generated. Dynamic partition pruning doesn't work. > explain select * from (select tbl1.*, rank() over (partition by id order by val) from tbl1) a where id in (select id from tbl1 where val>111); Query: explain select * from (select tbl1.*, rank() over (partition by id order by val) from tbl1) a where id in (select id from tbl1 where val>111) +------------------------------------------------------------------------------------+ | Explain String | +------------------------------------------------------------------------------------+ | Max Per-Host Resource Reservation: Memory=44.00MB | | Per-Host Resource Estimates: Memory=2.07GB | | WARNING: The following tables are missing relevant table and/or column statistics. | | default.tbl1 | | | | PLAN-ROOT SINK | | | | | 07:EXCHANGE [UNPARTITIONED] | | | | | 04:HASH JOIN [LEFT SEMI JOIN, BROADCAST] | | | hash predicates: id = id | | | | | |--06:EXCHANGE [BROADCAST] | | | | | | | 03:SCAN HDFS [default.tbl1] | | | partitions=2/2 files=2 size=8B | | | predicates: val > 111 | | | | | 02:ANALYTIC | | | functions: rank() | | | partition by: id | | | order by: val ASC | | | window: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW | | | | | 01:SORT | | | order by: id ASC NULLS FIRST, val ASC | | | | | 05:EXCHANGE [HASH(id)] | | | | | 00:SCAN HDFS [default.tbl1] | | partitions=2/2 files=2 size=8B | +------------------------------------------------------------------------------------+ Fetched 31 row(s) in 0.08s ### Analytic function is still in subquery, but the last "where" condition is simplified. Static partition pruning works. > explain select * from (select tbl1.*, rank() over (partition by id order by val) from tbl1) a where id in (2); Query: explain select * from (select tbl1.*, rank() over (partition by id order by val) from tbl1) a where id in (2) +------------------------------------------------------------------------------------+ | Explain String | +------------------------------------------------------------------------------------+ | Max Per-Host Resource Reservation: Memory=10.00MB | | Per-Host Resource Estimates: Memory=42.00MB | | WARNING: The following tables are missing relevant table and/or column statistics. | | default.tbl1 | | | | PLAN-ROOT SINK | | | | | 04:EXCHANGE [UNPARTITIONED] | | | | | 02:ANALYTIC | | | functions: rank() | | | partition by: id | | | order by: val ASC | | | window: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW | | | | | 01:SORT | | | order by: id ASC NULLS FIRST, val ASC | | | | | 03:EXCHANGE [HASH(id)] | | | | | 00:SCAN HDFS [default.tbl1] | | partitions=1/2 files=1 size=4B | +------------------------------------------------------------------------------------+ Fetched 22 row(s) in 0.02s