window {SparkR} | R Documentation |
Bucketize rows into one or more time windows given a timestamp specifying column. Window starts are inclusive but the window ends are exclusive, e.g. 12:05 will be in the window [12:05,12:10) but not in [12:00,12:05). Windows can support microsecond precision. Windows in the order of months are not supported.
## S4 method for signature 'Column' window(x, windowDuration, slideDuration = NULL, startTime = NULL) window(x, ...)
x |
a time Column. Must be of TimestampType. |
windowDuration |
a string specifying the width of the window, e.g. '1 second', '1 day 12 hours', '2 minutes'. Valid interval strings are 'week', 'day', 'hour', 'minute', 'second', 'millisecond', 'microsecond'. Note that the duration is a fixed length of time, and does not vary over time according to a calendar. For example, '1 day' always means 86,400,000 milliseconds, not a calendar day. |
slideDuration |
a string specifying the sliding interval of the window. Same format as
|
startTime |
the offset with respect to 1970-01-01 00:00:00 UTC with which to start
window intervals. For example, in order to have hourly tumbling windows
that start 15 minutes past the hour, e.g. 12:15-13:15, 13:15-14:15... provide
|
... |
further arguments to be passed to or from other methods. |
An output column of struct called 'window' by default with the nested columns 'start' and 'end'.
window since 2.0.0
Other datetime_funcs: add_months
,
add_months
,
add_months,Column,numeric-method
;
date_add
, date_add
,
date_add,Column,numeric-method
;
date_format
, date_format
,
date_format,Column,character-method
;
date_sub
, date_sub
,
date_sub,Column,numeric-method
;
datediff
, datediff
,
datediff,Column-method
;
dayofmonth
, dayofmonth
,
dayofmonth,Column-method
;
dayofyear
, dayofyear
,
dayofyear,Column-method
;
from_unixtime
, from_unixtime
,
from_unixtime,Column-method
;
from_utc_timestamp
,
from_utc_timestamp
,
from_utc_timestamp,Column,character-method
;
hour
, hour
,
hour,Column-method
; last_day
,
last_day
,
last_day,Column-method
;
minute
, minute
,
minute,Column-method
;
months_between
,
months_between
,
months_between,Column-method
;
month
, month
,
month,Column-method
;
next_day
, next_day
,
next_day,Column,character-method
;
quarter
, quarter
,
quarter,Column-method
;
second
, second
,
second,Column-method
;
to_date
, to_date
,
to_date
,
to_date,Column,character-method
,
to_date,Column,missing-method
;
to_timestamp
, to_timestamp
,
to_timestamp
,
to_timestamp,Column,character-method
,
to_timestamp,Column,missing-method
;
to_utc_timestamp
,
to_utc_timestamp
,
to_utc_timestamp,Column,character-method
;
unix_timestamp
,
unix_timestamp
,
unix_timestamp
,
unix_timestamp
,
unix_timestamp,Column,character-method
,
unix_timestamp,Column,missing-method
,
unix_timestamp,missing,missing-method
;
weekofyear
, weekofyear
,
weekofyear,Column-method
;
year
, year
,
year,Column-method
## Not run:
##D # One minute windows every 15 seconds 10 seconds after the minute, e.g. 09:00:10-09:01:10,
##D # 09:00:25-09:01:25, 09:00:40-09:01:40, ...
##D window(df$time, "1 minute", "15 seconds", "10 seconds")
##D
##D # One minute tumbling windows 15 seconds after the minute, e.g. 09:00:15-09:01:15,
##D # 09:01:15-09:02:15...
##D window(df$time, "1 minute", startTime = "15 seconds")
##D
##D # Thirty-second windows every 10 seconds, e.g. 09:00:00-09:00:30, 09:00:10-09:00:40, ...
##D window(df$time, "30 seconds", "10 seconds")
## End(Not run)