forked from influxdata/kapacitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
join.go
36 lines (32 loc) · 823 Bytes
/
join.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package tick
import (
"github.com/influxdata/kapacitor/pipeline"
"github.com/influxdata/kapacitor/tick/ast"
)
// JoinNode converts the JoinNode pipeline node into the TICKScript AST
type JoinNode struct {
Function
}
// NewJoin creates a JoinNode function builder
func NewJoin(parents []ast.Node) *JoinNode {
return &JoinNode{
Function{
Parents: parents,
},
}
}
// Build creates a JoinNode ast.Node
func (n *JoinNode) Build(j *pipeline.JoinNode) (ast.Node, error) {
joined := []interface{}{}
for _, p := range n.Parents[1:] {
joined = append(joined, p)
}
n.Pipe("join", joined...).
Dot("as", args(j.Names)...).
Dot("on", args(j.Dimensions)...).
Dot("delimiter", j.Delimiter).
Dot("streamName", j.StreamName).
Dot("tolerance", j.Tolerance).
DotNotNil("fill", j.Fill)
return n.prev, n.err
}