Support Questions

Find answers, ask questions, and share your expertise

Hive query for functions

avatar
Explorer

I'm a newbie, I want to calculate month on month percentage change in price change in my table. Im using hive and using query:

 

select year(stock_date),month(stock_date),sum(stock_price) over (partition by year(stock_date),month(stock_date) ORDER BY month(stock_date)), PERCENT_RANK() OVER(ORDER BY month(stock_date) DESC) AS per from table4;

 

it's generating, It's showing July 2019 at the top and goes descending thru the numbers. how do I get the months in correct order and the percentage change with it?

 

mystefied__0-1648012945794.png

can anyone help me understand what am I doing wrong?

 

12 REPLIES 12

avatar
Explorer

Im using a VM that is running this version. I'll try if I can update it. In case I can then I;ll try your queries again. 

 

Thanks a lot for trying to help. 

avatar
Explorer

Hello Andre,

 

Can you share the steps to upgrade the CDH / Hive to version 2 or 3 so at least the above commands can execute.


Also advise if I can download CDH 7 or 6 VM from Cloudera website, I do not have an active subscription but need trial for few days.

 

Thanks a lot for your help.

avatar
Super Guru

@mystefied_ ,

 

You can download the CDP Trial version from the Cloudera website below:

 

https://www.cloudera.com/downloads/cdp-private-cloud-trial/cdp-private-cloud-base-trial.html

 

Cheers,

André

 

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.