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
I think we should convert ApproxPercentileCont to a UDAF first. We can move ApproxPercentileCont and TDigest to function-aggregate, so that ApproxMedian can use them.
I agree, we need to convert ApproxPercentileCont first. For TDigest, we should move it to datafusion/physical-expr-common/src/aggregate/mod.rs where it can used not only for functions-aggregate but also other users that import physical-expr-common
I agree, we need to convert ApproxPercentileCont first. For TDigest, we should move it to datafusion/physical-expr-common/src/aggregate/mod.rs where it can used not only for functions-aggregate but also other users that import physical-expr-common
I think we need another PR to address this issue. For now, I just moved TDigest and ApproxPercentileAccumulator in #10840 so that I can convert approx_median to a UDAF.
I think we need another PR to address this issue. For now, I just moved TDigest and ApproxPercentileAccumulator in #10840 so that I can convert approx_median to a UDAF.
We can add self.args to AccumulatorArgs and compute percentile and tdigest max size in accumulator.
Activity
goldmedal commentedon Jun 9, 2024
take
goldmedal commentedon Jun 9, 2024
Hi @jayzhan211,
After some research, I found that
approx_medianheavily relies onApproxPercentileContfor accumulation.https://github.com/goldmedal/datafusion/blob/1600a307f272f9c716131dcca7a55ba1761774a6/datafusion/physical-expr/src/aggregate/approx_median.rs#L46
I think we should convert
ApproxPercentileContto a UDAF first. We can moveApproxPercentileContandTDigesttofunction-aggregate, so thatApproxMediancan use them.WDYT?
jayzhan211 commentedon Jun 9, 2024
I agree, we need to convert
ApproxPercentileContfirst. ForTDigest, we should move it todatafusion/physical-expr-common/src/aggregate/mod.rswhere it can used not only forfunctions-aggregatebut also other users that importphysical-expr-commongoldmedal commentedon Jun 9, 2024
Thanks. I will have a PR for it first.
goldmedal commentedon Jun 9, 2024
Hi @jayzhan211
I tried to convert
ApproxPercentileCont, but I encountered some challenges.ApproxPercentileContcreates the accumulator based on thepercentileparameter, but I couldn't find a way to access this parameter when defining the UDAF.https://github.com/goldmedal/datafusion/blob/24a08465e12bc07275cafe5310a7ac44898e39de/datafusion/physical-expr/src/aggregate/approx_percentile_cont.rs#L104
The
AccumulatorArgsdoesn't carry the original argument expression, making it difficult to create the accumulator forApproxPercentileCont.https://github.com/goldmedal/datafusion/blob/24a08465e12bc07275cafe5310a7ac44898e39de/datafusion/expr/src/function.rs#L45
I think we need another PR to address this issue. For now, I just moved
TDigestandApproxPercentileAccumulatorin #10840 so that I can convertapprox_medianto a UDAF.jayzhan211 commentedon Jun 9, 2024
We can add
self.argstoAccumulatorArgsand computepercentileandtdigest max sizeinaccumulator.datafusion/datafusion/physical-expr-common/src/aggregate/mod.rs
Lines 286 to 299 in 24a0846
goldmedal commentedon Jun 9, 2024
Thanks for the suggestion. I can make a PR after #10840.