[ https://issues.apache.org/jira/browse/HIVE-3046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281623#comment-13281623 ]
Edward Capriolo commented on HIVE-3046: --------------------------------------- I can guess that what hive does here is produce a result set of. client_id, date client_id, date client_id, date client_id, date client_id, date Then applies the WHERE and the MAX(). That would be nice. Sometimes if you can get all the partition predicates inside a since set of parens ( ) this will work properly. Or you might want to try using a sub-select or capture this variable before the query. > Hive should use metastore to calculate max() on a partition > ----------------------------------------------------------- > > Key: HIVE-3046 > URL: https://issues.apache.org/jira/browse/HIVE-3046 > Project: Hive > Issue Type: Improvement > Affects Versions: 0.7.1 > Reporter: Alex Rovner > > Assume you have a table with two partitioned columns: refdate and client_id > The following query runs a table scan instead of using partition metadata: > SELECT MAX(date) FROM mytable WHERE client_id=1 AND refdate >= 20120101 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira