-
Notifications
You must be signed in to change notification settings - Fork 1.9k
(Re)Support old syntax for approx_percentile_cont and approx_percentile_cont_with_weight
#16999
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3a1047b
Add sqllogictests
alamb 5329add
Allow both new and old sytanx for approx_percentile_cont and approx_p…
alamb fa2cdee
Merge remote-tracking branch 'apache/main' into alamb/old_approx_dist…
alamb 62c15a8
Update docs
alamb 6c283df
Add documentation and more tests
alamb 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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1337,7 +1337,7 @@ SELECT approx_distinct(c9) AS a, approx_distinct(c9) AS b FROM aggregate_test_10 | |
| ## Column `c12` is omitted due to a large relative error (~10%) due to the small | ||
| ## float values. | ||
|
|
||
| #csv_query_approx_percentile_cont (c2) | ||
| # csv_query_approx_percentile_cont (c2) | ||
| query B | ||
| SELECT (ABS(1 - CAST(approx_percentile_cont(0.1) WITHIN GROUP (ORDER BY c2) AS DOUBLE) / 1.0) < 0.05) AS q FROM aggregate_test_100 | ||
| ---- | ||
|
|
@@ -1353,6 +1353,23 @@ SELECT (ABS(1 - CAST(approx_percentile_cont(0.9) WITHIN GROUP (ORDER BY c2) AS D | |
| ---- | ||
| true | ||
|
|
||
|
|
||
| # csv_query_approx_percentile_cont (c2, alternate syntax, should be the same as above) | ||
| query B | ||
| SELECT (ABS(1 - CAST(approx_percentile_cont(c2, 0.1) AS DOUBLE) / 1.0) < 0.05) AS q FROM aggregate_test_100 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now both the new and old queries work |
||
| ---- | ||
| true | ||
|
|
||
| query B | ||
| SELECT (ABS(1 - CAST(approx_percentile_cont(c2, 0.5) AS DOUBLE) / 3.0) < 0.05) AS q FROM aggregate_test_100 | ||
| ---- | ||
| true | ||
|
|
||
| query B | ||
| SELECT (ABS(1 - CAST(approx_percentile_cont(c2, 0.9) AS DOUBLE) / 5.0) < 0.05) AS q FROM aggregate_test_100 | ||
| ---- | ||
| true | ||
|
|
||
| # csv_query_approx_percentile_cont (c3) | ||
| query B | ||
| SELECT (ABS(1 - CAST(approx_percentile_cont(0.1) WITHIN GROUP (ORDER BY c3) AS DOUBLE) / -95.3) < 0.05) AS q FROM aggregate_test_100 | ||
|
|
@@ -1793,6 +1810,17 @@ c 122 | |
| d 124 | ||
| e 115 | ||
|
|
||
|
|
||
| # csv_query_approx_percentile_cont_with_weight (should be the same as above) | ||
| query TI | ||
| SELECT c1, approx_percentile_cont(c3, 0.95) AS c3_p95 FROM aggregate_test_100 GROUP BY 1 ORDER BY 1 | ||
| ---- | ||
| a 73 | ||
| b 68 | ||
| c 122 | ||
| d 124 | ||
| e 115 | ||
|
|
||
| query TI | ||
| SELECT c1, approx_percentile_cont(0.95) WITHIN GROUP (ORDER BY c3 DESC) AS c3_p95 FROM aggregate_test_100 GROUP BY 1 ORDER BY 1 | ||
| ---- | ||
|
|
@@ -1812,6 +1840,17 @@ c 122 | |
| d 124 | ||
| e 115 | ||
|
|
||
| # csv_query_approx_percentile_cont_with_weight alternate syntax | ||
| query TI | ||
| SELECT c1, approx_percentile_cont_with_weight(c3, 1, 0.95) AS c3_p95 FROM aggregate_test_100 GROUP BY 1 ORDER BY 1 | ||
| ---- | ||
| a 73 | ||
| b 68 | ||
| c 122 | ||
| d 124 | ||
| e 115 | ||
|
|
||
|
|
||
| query TI | ||
| SELECT c1, approx_percentile_cont_with_weight(1, 0.95) WITHIN GROUP (ORDER BY c3 DESC) AS c3_p95 FROM aggregate_test_100 GROUP BY 1 ORDER BY 1 | ||
| ---- | ||
|
|
||
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
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.
there appears to be no tests for this error nor any reason I can see for not allowing it