-
Notifications
You must be signed in to change notification settings - Fork 492
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
Support Group By fields #624
Comments
I have started working on this and I think I want to approach it slightly differently. Instead of allowing fields to be specified as a groupBy dimension, rather allow fields to be converted into tags. The end result is the same but since the conversion from field to tag can be complicated or even invalid I would rather that conversion be explicit. For example:
But what if the field wasn't a string to begin with. You could for example group ints or floats into buckets.
Or if the value is an int with low cardinality like an enum:
Or multiple fields into tags at once.
Or doing something invalid will log an error. For example given that "idle" is a float, if its not explicitly converted it will raise an error.
Using this approach provides greater flexibility and control over how a field becomes a tag. Its also useful beyond simply grouping by fields. Does the |
@gunnaraasen @rkuchan @rossmcdonald Do you have any thoughts on this? How to make it more clear that the result of an eval is a tag? |
I like the flexibility of this approach, although I can't think of any other alternatives off the top of my head. What do you think about implicitly casting everything passed through I'm not a huge fan of the name Does grouping fields into tags drop the field? |
@gunnaraasen Thanks for the input. I like
Ah, good question. In most cases I would assume yes, because it is redundant information at that point. But in some cases like bucket example above it could make sense to keep the field. To make it simple to reason about I say we let that be decided via the Examples:
I like it because it will allow us to type check the expression and provide useful errors to the user, when they define the task as opposed to when they enable the task for the first time. There is change that needs to happen before that will work, but long term it will work, so better set the correct expectation now. |
+1 to I like the idea of choosing whether to keep the field or not, but the I agree that type checking the expression to see if it returns a string is useful. Would it be possible to return an error when the task is defined instead of during runtime? |
Not yet, but once we implement typed functions in TICKscript then it will be possible.
There isn't, hence I have added a DeleteNode as part of this change.
it mirrors well with the Default node
The eval node has always had the keep option. Since it can create new field (and now tags), we needed an explicit way to mark which fields you want to keep, and which you want to drop. |
Kapacitor only allows you to group by tag values. It seems useful to enable Kapacitor to be able to group by fields. This will introduce the potential for high cardinality issues but after #610 we will have a solution to help relieve that pressure.
Also this fix should probably incorporate a fix for #466
The text was updated successfully, but these errors were encountered: