axiomhq / quantiles

Optimal Quantile Approximation in Streams
MIT License
163 stars 11 forks source link

[Question] Is it impossible to keep adding data while getting summary for quantiles? #3

Closed etsangsplk closed 5 years ago

etsangsplk commented 6 years ago

I am researching what online data structure that can help answering the questions like : top X events so far : top X event by this key so far : top 10% of events so far .. But otice that it is required to call Finalize() before getting any summary results. And I cannot push any more events post Finalize(). Is each instance of Sketch only for one off computation? And need to be thrown away and use a new instance of Sketch for a new question?

I have similar questions about hyperlolog repo and flipcounter

seiflotfy commented 5 years ago

Create a new Sketch then use PushSummary() which pushes full summary while maintaining approximation error invariants. https://github.com/axiomhq/quantiles/blob/master/sketch.go#L101