brimdata / super

An analytics database that puts JSON and relational tables on equal footing
https://zed.brimdata.io/
BSD 3-Clause "New" or "Revised" License
1.39k stars 67 forks source link

Intentional early exit #5298

Open philrz opened 2 months ago

philrz commented 2 months ago

tl;dr

A user may want to craft a pipeline that intentionally stops processing the input stream when a particular condition is met.

Details

At the time this issue is being filed, Zed is at commit c1da204.

A user inquired in a recent community Slack thread:

Are head and tail the only two ways to terminate processing a stream? If I'm processing a potentially long stream of text data (-i line), and I know I want to stop processing after, say, an empty line comes through, I can't think of a way to do that.

Upon seeing this @mattnibs remarked:

Yeah, I’ve thought about having an exit operator that takes a Boolean expression and exits when the expression evaluates true.

chrismo commented 2 months ago

How would this work on a branch? (i.e. within a fork call, etc). I presume exit could just terminate the current branch?

mattnibs commented 2 months ago

@chrismo a fork will keep passing values to all non-closed branches.