Yibing Shi created HIVE-14661: --------------------------------- Summary: Hive should extract deterministic conditions from where clause and use them for partition pruning Key: HIVE-14661 URL: https://issues.apache.org/jira/browse/HIVE-14661 Project: Hive Issue Type: Improvement Reporter: Yibing Shi
Currently, if a non-deterministic function is used in where clause, partition pruning doesn't work. This can be reproduced as below: {code:sql} create table part1 (id int, content string) partitioned by (p int); alter table part1 add partition(p=1); alter table part1 add partition(p=2); create table part2 (id int, another_content string); set hive.mapred.mode=strict; set hive.cbo.enable=false; explain select p1.id, p1.content, p2.another_content from part1 p1 join part2 p2 on p1.id=p2.id where p1.p=1 and rand < 0.5; {code} The last query would fail with below error: {noformat} 16/08/23 23:55:52 ERROR ql.Driver: [main]: FAILED: SemanticException [Error 10041]: No partition predicate found for Alias "p1" Table "part1" org.apache.hadoop.hive.ql.parse.SemanticException: No partition predicate found for Alias "p1" Table "part1" {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)