Hey folks, does anyone know if Daft has anything s...
# general
y
Hey folks, does anyone know if Daft has anything similar to ray data's
AggregateFnV2
interface to define an efficient aggregation UDF
j
@Robert Howell @Kevin Wang have been working hard on UDFs I believe today we don’t differentiate them, but we’re reworking the UDF interface now as we speak. @Kevin Wang could you maybe share an example of how to do it with today’s map_groups API or point to some documentation?
y
Ty. Asking cuz one of our friends run into this when migrating their custom aggregator from ray data to daft and seeing the aggregation performance dropped from 40s to 11m without built in support like AggregateFnV2
👍 1
k
@Yufan here are the docs for our map_groups API which can be used to run aggregations using UDFs.
daft party 1
clapclap e 1
We are currently working on building a new UDF API which will eventually include aggregate UDFs. One of the reasons we have not solidified an API for them yet is because we are still trying to understand the specific use cases around it. To that end, @Yufan it would be greatly appreciated if you could share some details about what you or your friends would want to use aggregate UDFs to accomplish
👍 1
y
Yeah we are aggregating a column of bitmaps to return the number of distinct elements of the final aggregated bitmap
k
Ah so is your aggregation function one that takes in a column of bitmaps and returns a number representing the number of distinct bitmaps?
👍 1
y
Um slightly different actually, it returns the number of distinct elements in the aggregated bitmap, not the number of bitmaps 😄
k
Could you elaborate on what the aggregated bitmap is? And what an element in a bitmap would be?
y
Say for a column of bitmaps [{1,2}, {2,3},{1,2}] we expect the result being 3 ( len({1,2,3}) )
k
Ah so is each bitmap a list of numbers, and you essentially want to find the size of the set of unique numbers from all the bitmaps
y
Yup!
from pyroaring import BitMap
This is the bitmap library they used in ray data
k
I'm not sure what the performance will be, but if you could convert the roaring bitmap into a list type in Daft, you could use the agg_set expression to get the unique values from it, and then do a list.length to then get the size of that set
Our built-in agg_set aggregation is pretty efficient so it would be up to the conversion between bitmap and list
y
Gotcha will do and get back to you soon
👍 1
r
Hi @Yufan we've opened an issue to track this ask. Would you please include any additional requirements or asks there, and we can track this work? Thank you 🙏
👍 1
y
that pretty much covers my need. thanks for openinig this up.