You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ft.aggregate): Add FIRST_VALUE reducer function with BY clause support
- Add FIRST_VALUE reducer with three variants: simple mode (1 arg), BY clause mode (3 args), and BY clause with ASC/DESC (4 args)
- Update ft.aggregate.md documentation with FIRST_VALUE syntax and behavior descriptions
- Implement FIRST_VALUE in ft_aggregate_exec.cc with support for sorted and unsorted grouping modes
- Add comprehensive test coverage in ft_aggregate_exec_test.cc including BY clause variants, case-insensitive keywords, edge cases with nil values, and error conditions
- Update ft.aggregate.json command schema to reflect new reducer function
- Add integration tests in test_non_vector.py with multiple test cases for deterministic BY-clause behavior
- Regenerate compatibility test answers in aggregate-answers.pickle.gz
- Simple mode (non-deterministic) intentionally excluded from compatibility tests due to order-dependent results between Redis and Valkey implementations
Signed-off-by: Riley Des <riley.desserre@improving.com>
Copy file name to clipboardExpand all lines: docs/commands/ft.aggregate.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,3 +92,6 @@ The following reducer functions are available. The reducer functions that take a
92
92
| MAX 1 <expression> | The largest numerical values of the expression. |
93
93
| AVG 1 <expression> | The numerical average of the values of the expression. |
94
94
| STDDEV 1 <expression> | The standard deviation the values of the expression. |
95
+
| FIRST_VALUE 1 <expression> | The first value of the expression encountered in the group. Order depends on record retrieval order. Use only when order does not matter. |
96
+
| FIRST_VALUE 3 <expression> BY <expression> | The value of the first expression from the record with the smallest comparison expression (ascending). Ties broken by first-encountered order. |
97
+
| FIRST_VALUE 4 <expression> BY <expression> ASC\|DESC | The value of the first expression from the record with the minimum (ASC) or maximum (DESC) comparison expression. Ties broken by first-encountered order. Invalid keyword arguments (e.g., wrong BY token or unrecognised direction) produce a parse-time error. |
0 commit comments