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: Support unary, paren, bool keyword and nonexistent metric/label in PromQL #1049

Merged
merged 7 commits into from
Feb 21, 2023

Conversation

waynexia
Copy link
Member

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

  • Support bool keyword (some_metric > bool 1)
  • Support unary expr (-some_metric)
  • Support paren expr ((some_metric))
  • Do not report error when querying a nonexistent label/metric.

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)

Part of #1042

@waynexia waynexia added the C-enhancement Category Enhancements label Feb 21, 2023
@waynexia waynexia added this to the v0.2 milestone Feb 21, 2023
@codecov
Copy link

codecov bot commented Feb 21, 2023

Codecov Report

Merging #1049 (8d5d12f) into develop (9161796) will decrease coverage by 0.11%.
The diff coverage is 79.24%.

@@             Coverage Diff             @@
##           develop    #1049      +/-   ##
===========================================
- Coverage    85.81%   85.71%   -0.11%     
===========================================
  Files          444      446       +2     
  Lines        64568    64897     +329     
===========================================
+ Hits         55411    55628     +217     
- Misses        9157     9269     +112     
Flag Coverage Δ
rust 85.71% <79.24%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/servers/src/promql.rs 40.40% <72.72%> (+5.08%) ⬆️
src/promql/src/planner.rs 88.27% <80.00%> (+1.35%) ⬆️
src/object-store/src/test_util.rs 0.00% <0.00%> (-100.00%) ⬇️
src/datanode/src/instance.rs 43.77% <0.00%> (-14.34%) ⬇️
tests-integration/src/test_util.rs 79.08% <0.00%> (-9.51%) ⬇️
src/frontend/src/table/scan.rs 85.18% <0.00%> (-5.56%) ⬇️
src/servers/src/opentsdb.rs 96.82% <0.00%> (-1.59%) ⬇️
src/servers/src/opentsdb/handler.rs 93.81% <0.00%> (-1.04%) ⬇️
src/mito/src/engine.rs 98.11% <0.00%> (-0.28%) ⬇️
src/table/src/engine.rs 96.55% <0.00%> (ø)
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@evenyag evenyag 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

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

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

LGTM

@killme2008 killme2008 merged commit 23092a5 into GreptimeTeam:develop Feb 21, 2023
@waynexia waynexia deleted the prom-unary branch February 21, 2023 11:07
paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
… in PromQL (GreptimeTeam#1049)

* feat: don't report metric/label not found as error

Signed-off-by: Ruihang Xia <[email protected]>

* feat: impl unary expr

Signed-off-by: Ruihang Xia <[email protected]>

* feat: impl paren expr

Signed-off-by: Ruihang Xia <[email protected]>

* feat: support bool keyword

Signed-off-by: Ruihang Xia <[email protected]>

* add some tests

Signed-off-by: Ruihang Xia <[email protected]>

* ignore nonexistence labels during planning

Signed-off-by: Ruihang Xia <[email protected]>

* fix clippy

Signed-off-by: Ruihang Xia <[email protected]>

---------

Signed-off-by: Ruihang Xia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category Enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants