Skip to content
Advertisement

Hiveql – Aggregating hourly data to daily

I’m very new to Hiveql and would like some help with a very simple issue.

I have a table of hourly data, I’ve provided a simplified example below:

The goal is to create an output where I have datetimetimezone stripped down to “yyyymmdd” format with values being aggregated (SUM) from hourly to daily. So I would end up with a new output like the below:

I know I can use substr(datetimetimezone, 0, 8) to obtain the required date format, however I am unsure on how to aggregate ID values from hourly to daily as the second table above shows. Any help is welcome.

Advertisement

Answer

You seem to want the following aggregation query:

Note that substr() starts at 1 rather than 0.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement