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

feat: implement predict_linear function in promql #1362

Merged
merged 7 commits into from
Apr 14, 2023
Merged

feat: implement predict_linear function in promql #1362

merged 7 commits into from
Apr 14, 2023

Conversation

haohuaijin
Copy link
Contributor

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

Implement predict_linear function in promql and add some unit test. Extract linear_regression from deriv.rs to functions.rs for reuse it in predict_linear.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

#1349

@codecov
Copy link

codecov bot commented Apr 11, 2023

Codecov Report

Merging #1362 (8cbc6ab) into develop (ae21c1c) will decrease coverage by 0.36%.
The diff coverage is 96.90%.

@@             Coverage Diff             @@
##           develop    #1362      +/-   ##
===========================================
- Coverage    86.04%   85.68%   -0.36%     
===========================================
  Files          523      531       +8     
  Lines        78396    79235     +839     
===========================================
+ Hits         67454    67895     +441     
- Misses       10942    11340     +398     

@waynexia waynexia self-requested a review April 11, 2023 08:46
Copy link
Member

@waynexia waynexia left a comment

Choose a reason for hiding this comment

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

Thanks for this. And sorry that I forget to mention, except for implementing the PredictLinear struct, you also need to initialize it in the planner. This part in holt_winters can be a good reference

src/promql/src/functions.rs Show resolved Hide resolved
Copy link
Member

@waynexia waynexia left a comment

Choose a reason for hiding this comment

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

Looks pretty, thanks 🚀

src/promql/src/functions.rs Show resolved Hide resolved
src/promql/src/functions.rs Show resolved Hide resolved
src/promql/src/functions/predict_linear.rs Show resolved Hide resolved
src/promql/src/functions/predict_linear.rs Show resolved Hide resolved
src/promql/src/functions.rs Show resolved Hide resolved
@waynexia waynexia requested a review from sunng87 April 14, 2023 10:52
@sunng87 sunng87 merged commit a5771e2 into GreptimeTeam:develop Apr 14, 2023
@haohuaijin haohuaijin deleted the predict_linear branch April 16, 2023 07:43
@waynexia
Copy link
Member

Thanks @haohuaijin, and @sunng87 for reviewing

paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
* feat: implement predict_linear function in promql

* feat: initialize predict_linear's planner

* fix(bug): fix a bug in linear regression and add some unit test for linear regression

* chore: format code

* feat: deal with NULL value in linear_regression

* feat: add test for all value is None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants