Skip to content

Avoid collecting entire partition(s), when no Comparator is provided with a window #177

@lukaseder

Description

@lukaseder

When using only the frame clause (and possibly the partition function), subsequent window function evaluations can be done lazily, as they do not necessarily depend on the whole partition(s) being collected in advance.

For instance, when doing a sliding sum like this:

Seq.of(1, 2, 3, 4, 5, 6, 7...)
   .window(-1, 1)
   .map(w -> w.sum())
   .limit(3)
   .toList();

The result here is:

[Optional[3], Optional[6], Optional[9]]

There is no need to go beyond item no. 4 (limit + frame upper bound) in collecting the stream.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions