[doc] Add exponential_moving_average aggregate function documentation#3726
Merged
Conversation
Contributor
Author
|
run buildall |
### What problem does this PR solve? Problem Summary: Doris added the exponential_moving_average aggregate function but no documentation existed. - English doc with syntax, parameters, return value, and examples (basic, GROUP BY, NULL handling, empty set, window function, constant requirement). - Chinese (zh-CN) translation. - Sidebar entry in both aggregate-functions and analytic-functions lists. ### Release note None ### Check List (For Author) - Test: No need to test (docs only) - Behavior changed: No - Does this need documentation: No (this IS the documentation)
Contributor
Author
|
run buildall |
Contributor
Author
|
/review |
HappenLee
added a commit
to apache/doris
that referenced
this pull request
May 22, 2026
…63499) Problem Summary: Doris lacked an exponential moving average aggregate function. This implements `exponential_moving_average(half_decay, value, time)` ported from ClickHouse's ExponentialMovingAverage aggregate. Algorithm: - State stores (value, time, half_decay) as doubles. - On add(): scale existing value to the new timestamp via `2^(-dt/half_decay)`, then accumulate. Store half_decay in state so it is available during merge(). - On merge(): advance both states to the later timestamp, then sum. This is commutative and associative, so row order doesn't matter. - Result: `value * (1 - 2^(-1/half_decay))` (normalised by sum of weights). Changes: - BE: `aggregate_function_ema.h/cpp` — state struct + function class, registered in `aggregate_function_simple_factory.cpp`. - FE: `ExponentialMovingAverage.java` — 3-arg DOUBLE signature, visitor method added to `AggregateFunctionVisitor`, registered in `BuiltinAggregateFunctions`. - Regression test: `query_p0/aggregate/exponential_moving_average/`. ### Release note New aggregate function `exponential_moving_average(half_decay, value, time)` computes the exponential moving average over a stream of (value, time) pairs with the given half-decay parameter. ### Check List (For Author) - Test: Regression test added (query_p0/aggregate/exponential_moving_average) - Behavior changed: No (new function) - Does this need documentation: [docs](apache/doris-website#3726) --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Problem Summary:
Doris added the exponential_moving_average aggregate function but no documentation existed.
Release note
None
Check List (For Author)
Versions
Languages
Docs Checklist