-
Notifications
You must be signed in to change notification settings - Fork 453
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
Add sort and sort_desc #1104
Add sort and sort_desc #1104
Conversation
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.
Considering that these are noops, there's no reason to create a proper function for them.
Just handle them in the parser by calling walk
on the enclosed expressions with a comment, similar to how *pql.ParenExpr
is handled
Codecov Report
@@ Coverage Diff @@
## master #1104 +/- ##
==========================================
+ Coverage 70.13% 70.16% +0.03%
==========================================
Files 670 670
Lines 55644 55663 +19
==========================================
+ Hits 39024 39056 +32
+ Misses 14098 14087 -11
+ Partials 2522 2520 -2
Continue to review full report at Codecov.
|
bfd9b8e
to
6152ff2
Compare
@@ -160,11 +160,15 @@ func (p *parseState) walk(node pql.Node) error { | |||
} | |||
} | |||
|
|||
op, err := NewFunctionExpr(n.Func.Name, argValues, stringValues) | |||
op, ok, err := NewFunctionExpr(n.Func.Name, argValues, stringValues) |
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.
Would prefer this check here for n.func.name and return nil if it's a sort, rather than adding awkward third return param
// NB: Because Prometheus's sort and sort_desc only look at the last value, | ||
// these functions are essentially noops in M3 as we don't support instant queries. | ||
|
||
// SortType returns timeseries elements sorted by their values, in ascending order. |
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.
This file seems unnecessary? Would prefer to keep these in parser, as this doesn't add too much context
No description provided.