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

Wire up Top aggregate function #3930

Merged
merged 37 commits into from
Sep 4, 2015
Merged

Wire up Top aggregate function #3930

merged 37 commits into from
Sep 4, 2015

Conversation

corylanou
Copy link
Contributor

Issue

This addresses #1821
Also of interest (but not solved for in this PR) is Bottom: #1820

Aggregate Validations

We were doing aggregate validations in two separate spots. This PR consolidates all of it to fail faster in the parser validation, not in the function mapping validation.

}

// Secondly, determine if specific calls have at least one and only one argument
// Secondly, determine if specific calls have the correct number of arguments
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were validating aggregate functions in functions.go as well, and this was all work we could do ahead of time, plus it was fragmenting who was responsible for validating. This moves it all up before we even start mapping calls and falls earlier.

@corylanou corylanou force-pushed the top branch 2 times, most recently from 21eafb0 to ae1ef89 Compare September 3, 2015 20:06
@corylanou corylanou changed the title WIP - Top Top - Complete - Refactoring in progress Sep 3, 2015
@@ -0,0 +1,37 @@
package slices
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not a fan of utility packages, so if anyone has a better suggestion on where to put this/name it fire away.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've seen some projects use pkg as the root for utility packages that are usable outside of the project. See https://github.com/docker/docker/tree/master/pkg, https://github.com/coreos/etcd/tree/master/pkg and https://github.com/kubernetes/kubernetes/tree/master/pkg. They sometimes put a README.md in there as well. I kind of like pkg as opposed to helpers.

@corylanou corylanou changed the title Top - Complete - Refactoring in progress Top Sep 4, 2015
@corylanou corylanou changed the title Top Wire up Top aggregate function Sep 4, 2015
@corylanou corylanou force-pushed the top branch 2 times, most recently from e5146ee to f199dc5 Compare September 4, 2015 15:46
}
callArgs := c.Fields()
tags := itr.Tags()
// TODO send fields in
Copy link
Contributor

Choose a reason for hiding this comment

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

Did this get done?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, we are doing it in a future PR, I left it in as a future TODO. Is there a better way to note that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know what the TODO actually means. Maybe elaborate a bit more on what is missing and needs to be done?

@jwilder
Copy link
Contributor

jwilder commented Sep 4, 2015

A few small things but LGTM. 👍.

@@ -11,6 +11,8 @@ With this release InfluxDB is moving to Go 1.5.
- [#3876](https://github.com/influxdb/influxdb/pull/3876): Allow the following syntax in CQs: INTO "1hPolicy".:MEASUREMENT
- [#3975](https://github.com/influxdb/influxdb/pull/3975): Add shard copy service
- [#3986](https://github.com/influxdb/influxdb/pull/3986): Support sorting by time desc
- [#3930](https://github.com/influxdb/influxdb/pull/3930): Wire up TOP aggregate function
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicating this in the CHANGELOG looks wrong to me. I think it's better to keep the first line, and then add "fixes #1821" to the line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed, I'll make the change.

@otoolep
Copy link
Contributor

otoolep commented Sep 4, 2015

OK, took a look, my understand of the work required isn't super-deep, but we have decent testing around this so it should be OK.

+1, some minor feedback.

@corylanou
Copy link
Contributor Author

@otoolep addressed feedback.

@otoolep
Copy link
Contributor

otoolep commented Sep 4, 2015

Great, the feedback was minor so merge away on green.

corylanou added a commit that referenced this pull request Sep 4, 2015
Wire up Top aggregate function
@corylanou corylanou merged commit 1af8dd8 into master Sep 4, 2015
@corylanou corylanou deleted the top branch September 4, 2015 18:57
@Jhors2
Copy link

Jhors2 commented Sep 4, 2015

Is this feature also nestable with aggregates? I.e. top(sum(value), 10) from cpu group by hostname

@corylanou corylanou mentioned this pull request Sep 8, 2015
@prawnsalad
Copy link

@corylanou Going from the comments on a few issues, should we be able to run TOP() on an aggregate? ie. top(sum(value), 10) from cpu group by hostname

Testing this on 0.9.4.2 which the changelog mentions it should be possible (I think) however it does accept a nested aggregate.

@corylanou
Copy link
Contributor Author

You can not do a nested aggregate in top currently,

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.

5 participants