or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

async-operations.mddata-sources.mdfunction-interfaces.mdindex.mdkeyed-streams.mdoutput-operations.mdscala-extensions.mdstream-composition.mdstream-environment.mdstream-partitioning.mdstream-transformations.mdwindow-operations.mdwindowing.md

window-operations.mddocs/

0

# Window Operations and Aggregations

1

2

Operations that can be applied to windowed streams including built-in aggregations, custom window functions, and incremental aggregations.

3

4

## Built-in Aggregations

5

6

```scala { .api }

7

class WindowedStream[T, K, W <: Window] {

8

def sum(position: Int): DataStream[T]

9

def sum(field: String): DataStream[T]

10

def min(position: Int): DataStream[T]

11

def max(position: Int): DataStream[T]

12

def minBy(position: Int): DataStream[T]

13

def maxBy(position: Int): DataStream[T]

14

}

15

16

class AllWindowedStream[T, W <: Window] {

17

def sum(position: Int): DataStream[T]

18

def min(position: Int): DataStream[T]

19

def max(position: Int): DataStream[T]

20

def minBy(position: Int): DataStream[T]

21

def maxBy(position: Int): DataStream[T]

22

}

23

```

24

25

## Custom Window Functions

26

27

```scala { .api }

28

class WindowedStream[T, K, W <: Window] {

29

def apply[R: TypeInformation](function: WindowFunction[T, R, K, W]): DataStream[R]

30

def process[R: TypeInformation](function: ProcessWindowFunction[T, R, K, W]): DataStream[R]

31

def reduce(function: (T, T) => T): DataStream[T]

32

def aggregate[ACC: TypeInformation, R: TypeInformation](aggregateFunction: AggregateFunction[T, ACC, R]): DataStream[R]

33

}

34

```

35

36

Window operations enable computing results over finite subsets of infinite streams using time or count-based boundaries.