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

Add sort and sort_desc #1104

Merged
merged 3 commits into from
Oct 18, 2018
Merged

Add sort and sort_desc #1104

merged 3 commits into from
Oct 18, 2018

Conversation

benraskin92
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@arnikola arnikola left a 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
Copy link

codecov bot commented Oct 18, 2018

Codecov Report

Merging #1104 into master will increase coverage by 0.03%.
The diff coverage is 88.57%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#aggregator 81.61% <ø> (-0.03%) ⬇️
#collector 78.13% <ø> (ø) ⬆️
#dbnode 81.41% <ø> (+0.06%) ⬆️
#m3em 73.21% <ø> (ø) ⬆️
#m3ninx 75.25% <ø> (ø) ⬆️
#m3nsch 51.19% <ø> (ø) ⬆️
#metrics 18.38% <ø> (ø) ⬆️
#msg 74.98% <ø> (ø) ⬆️
#query 63.37% <88.57%> (+0.07%) ⬆️
#x 75.1% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b2fdac...6152ff2. Read the comment docs.

@@ -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)
Copy link
Collaborator

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.
Copy link
Collaborator

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

@benraskin92 benraskin92 merged commit f327667 into master Oct 18, 2018
@benraskin92 benraskin92 deleted the braskin/add-sort branch October 18, 2018 16:36
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