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

Function New

runtime/vam/expr/function/function.go:14–169  ·  view source on GitHub ↗
(sctx *super.Context, name string, narg int)

Source from the content-addressed store, hash-verified

12)
13
14func New(sctx *super.Context, name string, narg int) (expr.Function, error) {
15 argmin := 1
16 argmax := 1
17 var f expr.Function
18 switch name {
19 case "abs":
20 f = &Abs{sctx}
21 case "base64":
22 f = &Base64{sctx}
23 case "bucket":
24 argmin = 2
25 argmax = 2
26 f = &Bucket{sctx: sctx, name: name}
27 case "ceil":
28 f = &Ceil{sctx}
29 case "cidr_match":
30 argmin = 2
31 argmax = 2
32 f = NewCIDRMatch(sctx)
33 case "coalesce":
34 argmax = -1
35 f = &Coalesce{}
36 case "compare":
37 argmin = 2
38 argmax = 3
39 f = &samFunc{sctx, function.NewCompare(sctx)}
40 case "concat":
41 argmin = 1
42 argmax = -1
43 f = &Concat{sctx: sctx}
44 case "date_part":
45 argmin = 2
46 argmax = 2
47 f = &DatePart{sctx}
48 case "defuse":
49 f = &samFunc{sctx, function.NewDefuse(sctx)}
50 case "error":
51 f = &Error{sctx}
52 case "fields":
53 f = NewFields(sctx)
54 case "flatten":
55 f = newFlatten(sctx)
56 case "floor":
57 f = &Floor{sctx}
58 case "grep":
59 argmin = 2
60 argmax = 2
61 f = &Grep{sctx: sctx}
62 case "grok":
63 argmin, argmax = 2, 3
64 f = newGrok(sctx)
65 case "has":
66 argmax = -1
67 f = newHas(sctx)
68 case "has_error":
69 f = HasError{sctx}
70 case "hex":
71 f = &Hex{sctx}

Callers

nothing calls this directly

Calls 15

NewCompareFunction · 0.92
NewDefuseFunction · 0.92
NewUnblendFunction · 0.92
NewUpcastFunction · 0.92
CheckArgCountFunction · 0.92
NewCIDRMatchFunction · 0.85
newFlattenFunction · 0.85
newHasFunction · 0.85
newParseURIFunction · 0.85
newUnderFunction · 0.85
newUnflattenFunction · 0.85
NewFieldsFunction · 0.70

Tested by

no test coverage detected