LAST_K_EACH

Returns the last K values per given group.

Syntax

LAST_K_EACH([MAX_VALUES,] K, GROUP, VALUE)

Arguments

MAX_VALUES

Type:

Default: 2,147,483,647

(Optional) The maximum number of entries that are counted. If omitted, there is effectively no limit.

K

Type: integer

The number of entries to return.

GROUP

Type: any

The field to group by.

VALUE

Type: any

The field to get the last value(s) of.

Returns

Type: array

Returns an array of key-value pairs where each GROUP is matched to an array of the last K values of VALUE seen for that group.

Last updated