Hue Issue using Hive as source

Hi Team,

We are having CDH version 5.13.2 with Hue 4.

I am currently facing an issue with date_format function in Hue using Hive as source however the function is giving correct results through CLI.

Refer snapshot titled Query1_Error.PNG for the error. While querying date for D-2, the query is giving a date of one year ahead. This issue is only occurring for dates after 28th Dec.

Refer snapshot titled Query2_Ok.PNG for the same query but date of 28th.

Refer snapshot titled Query3.PNG without date_format function.

Refer snapshot titled Query4.PNG having current_date function.

Refer snapshot title CLI for the same query output in Hive shell.

Query1_Error Query3 Query4 CLI Query2_Ok

Looks like in the shell too date_sub() just subtract days without updating the months?

I just tried on https://demo.gethue.com/ which has Hive 2.1.1-cdh6.2.0 and it seems to be fine:

select date_sub(current_date(), 10)
> 2019-12-24

Hi Romain,

I am facing the issue with the year. If I run the query today i.e., 3rd January to extract data for 29th, 30th or 31st December, 2019 by subtracting 5, 4 and 3 respectively, I am getting date as given below:
select date_format(date_sub(current_date,5),‘YYYYMMdd’); --> 20201229
select date_format(date_sub(current_date,4),‘YYYYMMdd’); --> 20201230
select date_format(date_sub(current_date,3),‘YYYYMMdd’); --> 20201231

But it should give me the year 2019.

Also if I subtract 2 from the above query, then date is 20200101
or if I talk about any date before 29th Dec 2019, for instance I subtract 6 from the above query, then date is 20191228.

So the problem only exist with dates 29th,30th & 31st.

Hi People,
Any update ?