Gopal V created HIVE-22064:
------------------------------
Summary: CBO: Rewrite year() predicate to a constant condition
Key: HIVE-22064
URL: https://issues.apache.org/jira/browse/HIVE-22064
Project: Hive
Issue Type: Improvement
Reporter: Gopal V
{code}
CREATE TEMPORARY TABLE users (signup_date date, user_id bigint) stored as ORC;
INSERT INTO users values("1999-01-01", 1);
EXPLAIN ANALYZE
SELECT year(signup_date), count(distinct user_id) from users where
year(signup_date) BETWEEN 2017 and 2019
GROUP BY year(signup_date);
{code}
The YEAR() or EXTRACT(.... YEAR) is not rewritten into a constant for push-down.
{code}
EXPLAIN ANALYZE
SELECT year(signup_date), count(distinct user_id) from users where
signup_date BETWEEN DATE'2017-01-01' and DATE'2019-12-31'
GROUP BY year(signup_date);
{code}
Does push-down into the storage layers.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)