-
Notifications
You must be signed in to change notification settings - Fork 489
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
[feature request] support a paste operator in join.as() syntax #435
Comments
@jonseymour I like the suggestion but the names of the joining nodes are not always available. If they were I would make 'as' optional. Example: var metric1 = stream
|from()
.database('sampledb')
.retentionPolicy('default')
.measurement('sample')
.groupBy('node')
|window()
.align()
.period(5m)
.every(5m)
|shift(-5m)
|mean('metric1').as('metric1')
var metric2 = stream
|from()
.database('sampledb')
.retentionPolicy('default')
.measurement('sample')
.groupBy('node')
|window()
.align()
.period(5m)
.every(5m)
|shift(-5m)
|mean('metric2').as('metric2')
|join(metric1)
.as('m2', 'm1')
|log() While convention says that the above script is not readable and so its not used as much its still valid. Maybe we can make try and populate the Also the |
The paste operator would be optional of course - if you didn't specify it then current behaviour would apply. The paste operator would, of course, provide an easy way for the user choose their own delimiter, as in the example above where I used s_# and t_#. I also like your idea of making as() optional where possible. |
+1 for making as() optional. IMO it should only be required if two nodes have fields with the same name, much like when you attempt a join in MySQL on two tables that share columns you get an error like: "column 'id' is ambiguous". |
Closed via #698 |
As it currently stands, the field names in output stream if a Kapacitor join node are assigned prefixes of the form . where is the alias assigned to the Nth input stream by the as() property method of the join node.
So, for example:
will result in a stream with fields called 'm1.metric1' and 'm2.metric2'
It would be nice if the mandatory period in the resulting name could be avoided.
The suggestion to avoid this is to support use of a trailing paste operator in the arguments to as()
So:
would result in a stream with fields called s_metric1 and t_metric2 and
and:
would result in a stream with fields called: metric1 and metric2.
'#' is chosen to mimic similar behaviour in the C pre-processor.
Note: A specification of as('foo##', 'foo##') would result in names called 'foo#metric1', 'foo#metric2'.
A specification of as('foo#bar', 'foo#bar') would result in names called foo#bar.metric1 and foo#bar.metric2.
The text was updated successfully, but these errors were encountered: