Hive: query with one month
-- @param: target_date
set start_time=date_sub(${target_date}, 15);
set end_time=date_add(${target_date}, 15);
set start_year=year(${start_time});
set start_month=month(${start_time});
set start_day=day(${start_time});
set end_year=year(${end_time});
set end_month=month(${end_time});
set end_day=day(${end_time});
SELECT distinct month, day
from gh_rc
where (year>${hiveconf:start_year} OR (year=${hiveconf:start_year} AND (month> ${hiveconf:start_month} OR month=${hiveconf:start_month} AND day >= ${hiveconf:start_day})))
AND (year<${hiveconf:end_year} OR (year=${hiveconf:end_year} AND (month< ${hiveconf:end_month} OR month=${hiveconf:end_month} AND day <= ${hiveconf:end_day})))
-- -- AND