typedb / typeql

TypeQL: the power of programming, in your database
https://typedb.com
Mozilla Public License 2.0
218 stars 45 forks source link

Introduce Reduce keyword for stream reduction operations #363

Closed flyingsilverfin closed 1 month ago

flyingsilverfin commented 1 month ago

Usage and product changes

We introduce the missing reduce keyword for operations like min/max/count aggregations, as well as first() and check. However, we do not require the reduce keyword for function return statements:

match
  ...
reduce count($x);

in a function would be;

define 
fun test(...) -> long:
  match ...
  return count($x);

We also allow trailing commas throughout the grammar, though they are ignored, to allow the user to generate queries more simply:

match
  $x, isa person, has name $n, ... ; #equivalent to the user-friendly syntax: $x isa person, has name, ...;

Implementation

typedb-bot commented 1 month ago

PR Review Checklist

Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.


Trivial Change

Code

Architecture