gfw.common.beam.transforms.ApplySlidingWindows#

class ApplySlidingWindows(period, offset, assign_timestamps=False, timestamp_field='timestamp', **kwargs)[source]#

Applies sliding windows, optionally assigning event timestamps.

Parameters:
  • period (float) – The window period (interval between window start times), in seconds.

  • offset (float) – The offset to apply to window start times, in seconds.

  • assign_timestamps (bool) – Whether to assign timestamps using a field from each element.

  • timestamp_field (str) – The name of the field containing the timestamp (UNIX time, in seconds).

  • **kwargs (Any) – Additional keyword arguments passed to base PTransform class.

Methods

annotations

default_label

default_type_hints

display_data

Returns the display data associated to a pipeline component.

expand

Apply sliding windows to the input PCollection.

from_runner_api

get_resource_hints

get_type_hints

Gets and/or initializes type hints for this object.

get_windowing

Returns the window function to be associated with transform's output.

infer_output_type

register_urn

runner_api_requires_keyed_input

to_runner_api

to_runner_api_parameter

to_runner_api_pickled

type_check_inputs

type_check_inputs_or_outputs

type_check_outputs

with_input_types

Annotates the input type of a PTransform with a type-hint.

with_output_types

Annotates the output type of a PTransform with a type-hint.

with_resource_hints

Adds resource hints to the PTransform.

Attributes

label

pipeline

side_inputs

expand(pcoll)[source]#

Apply sliding windows to the input PCollection.

Optionally assigns event-time timestamps using the configured timestamp field.

Parameters:

pcoll (PCollection[Dict[str, Any]]) – A PCollection of dictionaries containing a timestamp field.

Returns:

A windowed PCollection with sliding windows applied.

Return type:

PCollection[Dict[str, Any]]