Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
first
and last
aggregate functions
Substrait already defines `first_value` and `last_value`, however they're defined as window functions. First and last are commonly used as aggregate functions, and having them as aggregates allows using them also in windows (but not the other way around), see https://substrait.io/expressions/window_functions/#aggregate-functions-as-window-functions Spark defines first and last as aggregate functions https://github.com/apache/spark/blob/a50b30d7a02bf45f1ddb8db0be6779b1441e1d4d/sql/core/src/main/scala/org/apache/spark/sql/functions.scala#L518 , and e.g. dropDuplicates is implemented as an aggregation using first() https://github.com/apache/spark/blob/a50b30d7a02bf45f1ddb8db0be6779b1441e1d4d/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala#L2262
- Loading branch information