CockroachDB supports the application of an aggregate or window function over the subset ("window") of the rows selected by a query.
Docs on this feature are coming soon. In the meantime, see the PostgreSQL documentation for an introduction to this topic.