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

[Enhancement](doris-future) Support "REGR_" aggregation functions (PART II) #41240

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

Yoruet
Copy link

@Yoruet Yoruet commented Sep 24, 2024

Proposed changes

Issue Number: close #38975

mysql> select * from test;
+------+------+------+
| id   | x    | y    |
+------+------+------+
|    1 |   18 |   13 |
|    3 |   12 |    2 |
|    5 |   10 |   20 |
|    2 |   14 |   27 |
|    4 |    5 |    6 |
+------+------+------+
5 rows in set (0.07 sec)

mysql> select regr_slope(y,x) , regr_intercept(y,x) from test;
+--------------------+----------------------+
| regr_slope(y, x)   | regr_intercept(y, x) |
+--------------------+----------------------+
| 0.6853448275862069 |    5.512931034482759 |
+--------------------+----------------------+
1 row in set (0.15 sec)

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@Yoruet Yoruet changed the title add regr_intercept and regr_slope aggregate functions [Enhancement](doris-future) Support "REGR_" aggregation functions (PART II) Sep 24, 2024
@zhiqiang-hhhh
Copy link
Contributor

@Yoruet Null property of regr_slope and regr_intercept should be AlwaysNullable on FE, so need to do some modification on be.

@zhiqiang-hhhh
Copy link
Contributor

@Yoruet You can take this pr #40945 as a reference.

@zhiqiang-hhhh
Copy link
Contributor

@Yoruet I add more comments with detail information.

@zhiqiang-hhhh
Copy link
Contributor

zhiqiang-hhhh commented Sep 27, 2024

Yoruet#1

@Yoruet I did some fix on regr_intercept on your branch, you can merge the pull request and do modification on other function. Test case should be taked.

Reference https://dbfiddle.uk/MmKrIU9r

Copy link
Contributor

@zhiqiang-hhhh zhiqiang-hhhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Null value is not processed correctly.

@Yoruet
Copy link
Author

Yoruet commented Sep 27, 2024

Null value is not processed correctly.

Can you provide corresponding test samples to me

@zhiqiang-hhhh
Copy link
Contributor

Null value is not processed correctly.

Can you provide corresponding test samples to me

@Yoruet You can try test case added in this pr Yoruet#1 on regr_slope

@Yoruet
Copy link
Author

Yoruet commented Sep 27, 2024

Null value is not processed correctly.

Can you provide corresponding test samples to me

@Yoruet You can try test case added in this pr Yoruet#1 on regr_slope

Null value is not processed correctly.

Can you provide corresponding test samples to me

@Yoruet You can try test case added in this pr Yoruet#1 on regr_slope

@zhiqiang-hhhh I compared the data in the test_regr_intercept.out file with that in https://dbfiddle.uk/MmKrIU9r, and it seems that there is nothing wrong. Can you provide more detailed information?

@zhiqiang-hhhh
Copy link
Contributor

Null value is not processed correctly.

Can you provide corresponding test samples to me

@Yoruet You can try test case added in this pr Yoruet#1 on regr_slope

Null value is not processed correctly.

Can you provide corresponding test samples to me

@Yoruet You can try test case added in this pr Yoruet#1 on regr_slope

@zhiqiang-hhhh I compared the data in the test_regr_intercept.out file with that in https://dbfiddle.uk/MmKrIU9r, and it seems that there is nothing wrong. Can you provide more detailed information?

The reason test_regr_intercept is correct is that I re-write the implementation of regr_itercept in that PR (I created that pull request on your branch to give you an example on how to fix regr_itercept).

You can compare the code I submitted with your implementation of regr_itercept, and do fix on regr_slope in a same way.

@Yoruet
Copy link
Author

Yoruet commented Sep 27, 2024

Null value is not processed correctly.

Can you provide corresponding test samples to me

@Yoruet You can try test case added in this pr Yoruet#1 on regr_slope

Null value is not processed correctly.

Can you provide corresponding test samples to me

@Yoruet You can try test case added in this pr Yoruet#1 on regr_slope

@zhiqiang-hhhh I compared the data in the test_regr_intercept.out file with that in https://dbfiddle.uk/MmKrIU9r, and it seems that there is nothing wrong. Can you provide more detailed information?

The reason test_regr_intercept is correct is that I re-write the implementation of regr_itercept in that PR (I created that pull request on your branch to give you an example on how to fix regr_itercept).

You can compare the code I submitted with your implementation of regr_itercept, and do fix on regr_slope in a same way.

Thanks for your help,and I have modified regr_slope in the same way

Copy link
Contributor

@zhiqiang-hhhh zhiqiang-hhhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make implementation of regr_slope same with regr_intecept.

@zhiqiang-hhhh
Copy link
Contributor

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 37.24% (9626/25847)
Line Coverage: 28.67% (79699/277954)
Region Coverage: 28.09% (41214/146710)
Branch Coverage: 24.70% (20973/84896)
Coverage Report: http://coverage.selectdb-in.cc/coverage/13d467650b398ef5119bdc98bd7a1ac69e676674_13d467650b398ef5119bdc98bd7a1ac69e676674/report/index.html

Copy link
Contributor

@zhiqiang-hhhh zhiqiang-hhhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

PR approved by anyone and no changes requested.

@zhiqiang-hhhh
Copy link
Contributor

We need todo a refactor on all REGR_ like agg functions, to make code simple. These agg functions have same structure.
eg. #39187

@Yoruet
Copy link
Author

Yoruet commented Sep 29, 2024

We need todo a refactor on all REGR_ like agg functions, to make code simple. These agg functions have same structure. eg. #39187

Does it include only regr_slope and regr_intercept or does it include other regr_ functions such as regr_sxx

@zhiqiang-hhhh
Copy link
Contributor

We need todo a refactor on all REGR_ like agg functions, to make code simple. These agg functions have same structure. eg. #39187

Does it include only regr_slope and regr_intercept or does it include other regr_ functions such as regr_sxx

This is just a comment to remind us to do a refactor in the future, does not means we need to do refactor in this pr.

@HappenLee
Copy link
Contributor

@Yoruet please add doc in https://github.com/apache/doris-website thank you very mush

@Yoruet
Copy link
Author

Yoruet commented Sep 29, 2024

@Yoruet please add doc in https://github.com/apache/doris-website thank you very mush

I have already pr the doc.plz check it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement](doris-future) Support "REGR_" aggregation functions (PART II)
4 participants