If i understand your question right, you want to pick the hour from the timestamp column which can be easily done from
But I could get want you meant by range. Do you want to generate the hour provided the start and end time/range? Is that what you are trying to convey?
I couldn't think of any built in function in hive to handle this scenario.
The other way of doing this is by using something like below:
7200 implies seconds needed for 2 hours as mentioned in your quetion. You can alter it based on your need.
Instead of the hardcoded value you can pass variable or row_number()over() * 3600 can be used to generate sequentially.
Hope it Helps!!