WindowFunction

@Beta
public final class WindowFunction


A class that represents a window function.

Window Functions SDK features are in preview until the backend feature launches. Look for launch announcement at: https://docs.cloud.google.com/firestore/docs/release-notes

Summary

Nested types

public static class WindowFunction.Companion

Public methods

final @NonNull AliasedWindowFunction

Assigns an alias to this window function.

boolean
equals(Object other)
int
final @NonNull WindowFunction

Evaluates this function over an explicit window frame.

static final @NonNull WindowFunction

Returns the rank of each document within its partition according to the window's sort order.

Public methods

alias

@Beta
public final @NonNull AliasedWindowFunction alias(@NonNull String alias)

Assigns an alias to this window function.

Window Functions SDK features are in preview until the backend feature launches. Look for launch announcement at: https://docs.cloud.google.com/firestore/docs/release-notes

Parameters
@NonNull String alias

The alias to assign to this window function.

Returns
@NonNull AliasedWindowFunction

A new AliasedWindowFunction that wraps this window function and associates it with the provided alias.

equals

public boolean equals(Object other)

hashCode

public int hashCode()

over

@Beta
public final @NonNull WindowFunction over(@NonNull WindowSpec window)

Evaluates this function over an explicit window frame.

Window Functions SDK features are in preview until the backend feature launches. Look for launch announcement at: https://docs.cloud.google.com/firestore/docs/release-notes

The returned function carries its own framing, overriding the window declared on the enclosing addWindowFields stage. Only documents or range window frames (created via WindowSpec.documents or WindowSpec.range) are supported on individual accumulators; other window parameters such as WindowSpec.partition or WindowSpec.sort are not supported on accumulator-level over() and must be specified on the enclosing addWindowFields stage.

Parameters
@NonNull WindowSpec window

The window frame specification to evaluate this function over.

Returns
@NonNull WindowFunction

A new WindowFunction with the given framing.

rank

@Beta
public static final @NonNull WindowFunction rank()

Returns the rank of each document within its partition according to the window's sort order. Documents with equal sort values receive the same rank, and the following rank is skipped. The window must specify exactly one sort ordering.

Window Functions SDK features are in preview until the backend feature launches. Look for launch announcement at: https://docs.cloud.google.com/firestore/docs/release-notes

Returns
@NonNull WindowFunction

A new WindowFunction representing the rank window function.