Iterate over arrays or objects within AQL

Instead of a bunch of specialised array and object functions we can leverage the existing sub-query functionality. The starting point is then a sequence of values from the preceding evaluation context, followed by the normal query transformations. The syntax for this is FROM [<expr>, ...] to disambiguate string expressions from tags.

FROM [1, 2, 3] AGGREGATE SUM(_) END

This would yield the number 6.

This feature combines well with #7310 (spread syntax) to process dynamically obtained arrays: FROM [...my_array].

Specification

The syntax FROM [<expr>, ...] produces a stream of values by emitting the given expression results one by one. The metadata of these values are passed along transparently. For values computed within the given expression, metadata are determined by the outer evaluation context as usual.

The outermost evaluation context uses a sort key of the Actyx node’s current lamport timestamp, stream ID all-zeros, and timestamp of the current Actyx node clock. Therefore the following query can be used to get the Actyx node’s logical and physical clock in the returned metadata:

FROM [42] END