Show start day and end day from a week and based on of a column summation value

57 views Asked by At

I have the data set from there. I need to show the start date and end date from a single column name is a timestamp and also show the precipitation, which is three or more inches of precipitation based on seven day period where week 1 contains the first 7 tuples in a stream (1 - 7), week 2 the following 7 tuples (8 -14)... and My results should contain

Result looks like

• Week_start • Week_end • Precipitation

Sample data

01/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  49  41  56  0.89    0.00    0
02/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  51  43  62  1.12    0.00    0
03/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  52  44  64  4.03    0.00    0
04/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  53  43  66  2.24    0.00    0
05/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  55  44  66  4.92    0.00    0
06/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  52  44  60  2.24    0.00    8
07/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  53  46  61  4.47    0.00    8
08/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  55  52  59  9.40    0.01    1
09/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  54  52  60  11.63   0.00    1
10/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  53  48  60  5.82    0.00    0
11/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  51  46  58  6.49    0.00    0
12/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  52  46  60  6.71    0.00    1
13/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  55  42  67  2.68    0.00    0
14/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  56  44  72  2.24    0.00    0
15/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  58  48  73  2.68    0.00    0
16/01/2014  USW00023234 SAN FRANCISCO INTERNATIONAL AIRPORT, CA US  58  46  73  2.01    0.00    0

First one is day and second last one is Precipitation. I need to show start date and end date of the week and Precipitation

Sample Output

Week_start  Week_end    Precipitation
01/01/2014  07/01/2014  3.1
1

There are 1 answers

0
Dakotah North On
select timestamp, sum(amount) 
from Precipitation#ext_timed_batch(timestamp, 1 week);

The above provides

Week_end • Precipitation

On a weekly tumbling window based on the date set in time stamp.