Subquery Inputs: What Events Are Processed

Subqueries can process different types of input events depending on the context:

  • Events from the primary query โ€” The subquery processes events from the primary query and runs once per event.

    Example: selfJoinFilter() uses a subquery to filter events from the primary query.

  • Variations of events from the primary query โ€” The subquery processes variations of the primary query events, such as individual elements from an array field, and runs once per element.

    Example: array:filter() runs the subquery once per array element to determine which elements to keep.

  • Events directly from a repository or view โ€” The subquery retrieves events directly from a repository or view, which can be the same as or different from the primary query. The time interval can also differ. This type is called an independent subquery because it runs independently of the primary query events.

    Example: join() uses independent subqueries to retrieve data from repositories or views and combine it with the primary query results.