MCPcopy Create free account
hub / github.com/brimdata/super / Apply

Function Apply

vector/apply.go:11–30  ·  view source on GitHub ↗

Apply applies eval to vecs. If any element of vecs is a Dynamic, Apply rips vecs accordingly, applies eval to the ripped vectors, and stitches the results together into a Dynamic. If ripUnions is true, Apply also rips Unions.

(ripUnions bool, eval func(...Any) Any, vecs ...Any)

Source from the content-addressed store, hash-verified

9// results together into a Dynamic. If ripUnions is true, Apply also rips
10// Unions.
11func Apply(ripUnions bool, eval func(...Any) Any, vecs ...Any) Any {
12 if ripUnions {
13 for k, vec := range vecs {
14 if union, ok := Under(vec).(*Union); ok {
15 vecs[k] = union.Dynamic
16 }
17 }
18 }
19 d, ok := findDynamic(vecs)
20 if !ok {
21 return eval(defuse(vecs)...)
22 }
23 results := make([]Any, len(d.Values))
24 for i, ripped := range rip(vecs, d) {
25 if len(ripped) > 0 {
26 results[i] = Apply(ripUnions, eval, ripped...)
27 }
28 }
29 return stitch(d.Tags, results)
30}
31
32func findDynamic(vecs []Any) (*Dynamic, bool) {
33 for _, vec := range vecs {

Callers 15

EvalMethod · 0.92
EvalMethod · 0.92
indexArrayOrSetFunction · 0.92
indexRecordFunction · 0.92
indexMapFunction · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.92

Calls 5

findDynamicFunction · 0.85
ripFunction · 0.85
stitchFunction · 0.85
UnderFunction · 0.70
defuseFunction · 0.70

Tested by

no test coverage detected