Eventual-Inc / Daft

Distributed data engine for Python/SQL designed for the cloud, powered by Rust
https://getdaft.io
Apache License 2.0
2.3k stars 158 forks source link

agg `first` functions #3096

Open universalmind303 opened 2 weeks ago

universalmind303 commented 2 weeks ago

Is your feature request related to a problem?

when performing groupby/aggs, its common to want to get the first value out of the group.

Describe the solution you'd like

df.agg(col("price").sum(), col("description").first())

Describe alternatives you've considered

No response

Additional Context

most dataframe libraries support this

Would you like to implement a fix?

No

universalmind303 commented 2 weeks ago

After some digging I found any_value which is functionally equivalent.

Thoughts on renaming this to first @samster25 @jaychia

samster25 commented 2 weeks ago

Although technically it works today, I don't think it's actually enforced that it will the first value that is seen. I think it may be better to have first() as a separate expression.