Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: opt nested agg calls #4022

Merged
merged 6 commits into from
Feb 18, 2025
Merged

Conversation

aceforeverd
Copy link
Collaborator

No description provided.

1. nested aggregate call
2. duplicated aggregate call
Initially we only intend to cache udaf calls under same window, this
change seem to cache all expressions under correct context.

This cache mechanism may not work since its not fully tested.
aggregate expression

A nested agg function call, e.g.

  agg_fn1(col1, agg_fn2(col2))

Will evaluate like a let expression:

  LET fn2 = agg_fn2(col2) IN agg_fn1(col1, fn2)

TODO:
- fix agg call cache
TOOD:

- there are some cases still need fix
@github-actions github-actions bot added the execute-engine hybridse sql engine label Feb 11, 2025
@Shouren Shouren changed the base branch from main to release/0.9.3 February 13, 2025 09:06
@Shouren Shouren changed the base branch from release/0.9.3 to main February 13, 2025 09:10
@Shouren Shouren merged commit e0e70a4 into 4paradigm:main Feb 18, 2025
11 of 15 checks passed
Shouren pushed a commit that referenced this pull request Feb 18, 2025
* perf(expr pass): cache aggregate function call in single projection

* test: add two test cases for aggregate calls

1. nested aggregate call
2. duplicated aggregate call

* feat(lambdafy): cache same expression

Initially we only intend to cache udaf calls under same window, this
change seem to cache all expressions under correct context.

This cache mechanism may not work since its not fully tested.

* feat(expr pass): letify expression to avoid repeated agg calls in nested
aggregate expression

A nested agg function call, e.g.

  agg_fn1(col1, agg_fn2(col2))

Will evaluate like a let expression:

  LET fn2 = agg_fn2(col2) IN agg_fn1(col1, fn2)

TODO:
- fix agg call cache

* feat(expr pass): equivalent agg call cache

TOOD:

- there are some cases still need fix

* fix: set output to id node for equivalent agg calls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
execute-engine hybridse sql engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants