-
Notifications
You must be signed in to change notification settings - Fork 587
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
feat(stream): add two-phase stateless simple approx percentile #17873
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1be08ab
support local stateless approx percentile
kwannoel 3d8f85b
handle chunk
kwannoel 1d2626d
handle barrier
kwannoel c8c900f
add local approx percentile proto
kwannoel 1170acc
from_proto for global
kwannoel 19060d6
convert plans to proto
kwannoel 48b3b46
fmt
kwannoel 0bd820d
defer keyed merge
kwannoel 356763b
interim commit: adding tests but failing
kwannoel a437469
revert some debug in global
kwannoel 768a70a
minor
kwannoel 5b0af78
add more test, fix bugs in calculating percentile
kwannoel c362ed2
support negative, but needs some fixes still, specifically we need to…
kwannoel b2d92ba
properly handle neg
kwannoel 5178950
revert debug stmts
kwannoel c134477
remove some fixme
kwannoel dbe8018
fmt
kwannoel a4d68b3
more fmt
kwannoel 6c93832
drop table and mv
kwannoel 84c656f
fix comments
kwannoel 66ecdea
ignore watermarks
kwannoel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
78 changes: 78 additions & 0 deletions
78
e2e_test/streaming/aggregate/two_phase_approx_percentile.slt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Single phase approx percentile | ||
statement ok | ||
create table t(p_col double, grp_col int); | ||
|
||
statement ok | ||
insert into t select a, 1 from generate_series(0, 10) t(a); | ||
|
||
statement ok | ||
insert into t values(0, 1); | ||
|
||
statement ok | ||
flush; | ||
|
||
statement ok | ||
create materialized view m1 as select | ||
approx_percentile(0.01, 0.01) within group (order by p_col) as p01 | ||
from t; | ||
|
||
statement ok | ||
flush; | ||
|
||
query I | ||
select * from m1; | ||
---- | ||
0 | ||
|
||
query I | ||
select percentile_cont(0.01) within group (order by p_col) from t; | ||
---- | ||
0 | ||
|
||
statement ok | ||
insert into t select a, 1 from generate_series(11, 1000) t(a); | ||
|
||
statement ok | ||
flush; | ||
|
||
query I | ||
select * from m1; | ||
---- | ||
8.93541864376352 | ||
|
||
query I | ||
select percentile_cont(0.01) within group (order by p_col) from t; | ||
---- | ||
9.01 | ||
|
||
query I | ||
select approx_percentile(0.01, 0.01) within group (order by p_col) from t group by grp_col; | ||
---- | ||
8.93541864376352 | ||
|
||
statement ok | ||
insert into t select a, 1 from generate_series(-1000, -1) t(a); | ||
|
||
statement ok | ||
flush; | ||
|
||
query I | ||
select * from m1; | ||
---- | ||
-982.5779489474152 | ||
|
||
query I | ||
select approx_percentile(0.01, 0.01) within group (order by p_col) from t group by grp_col; | ||
---- | ||
-982.5779489474152 | ||
|
||
query I | ||
select percentile_cont(0.01) within group (order by p_col) from t; | ||
---- | ||
-979.99 | ||
|
||
statement ok | ||
drop materialized view m1; | ||
|
||
statement ok | ||
drop table t; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we don't have any shuffle between the global approx percentile and the local approx percentile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't quite get it. We do have shuffle between local -> global approx percentile. May take a look at the output inside
agg.yaml
. There we have:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see it. My main branch is out of date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I think
StreamMerge
inputs could be changed from binary inputs to multi inputs likeStreamUnion
. Maybe the in next PR.