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

Function NewPattern

runtime/sam/expr/agg/agg.go:26–102  ·  view source on GitHub ↗
(op string, distinct, hasarg bool)

Source from the content-addressed store, hash-verified

24}
25
26func NewPattern(op string, distinct, hasarg bool) (Pattern, error) {
27 needarg := true
28 var pattern Pattern
29 switch op {
30 case "count":
31 needarg = false
32 pattern = func() Function {
33 var c Count
34 return &c
35 }
36 case "any":
37 pattern = func() Function {
38 return &Any{}
39 }
40 case "avg":
41 pattern = func() Function {
42 return &Avg{}
43 }
44 case "blend":
45 pattern = func() Function {
46 return newFuse(false)
47 }
48 case "dcount":
49 pattern = func() Function {
50 return NewDCount()
51 }
52 case "fuse":
53 pattern = func() Function {
54 return newFuse(true)
55 }
56 case "sum":
57 pattern = func() Function {
58 return newMathReducer(anymath.Add)
59 }
60 case "collect_map":
61 pattern = func() Function {
62 return NewCollectMap()
63 }
64 case "min":
65 pattern = func() Function {
66 return newMathReducer(anymath.Min)
67 }
68 case "max":
69 pattern = func() Function {
70 return newMathReducer(anymath.Max)
71 }
72 case "union":
73 pattern = func() Function {
74 return NewUnion()
75 }
76 case "collect":
77 pattern = func() Function {
78 return &Collect{}
79 }
80 case "and":
81 pattern = func() Function {
82 return &And{}
83 }

Callers 3

maybeConvertAggMethod · 0.92
isAggFuncFunction · 0.92
NewAggregatorFunction · 0.92

Calls 6

NewDCountFunction · 0.85
NewCollectMapFunction · 0.85
newFuseFunction · 0.70
newMathReducerFunction · 0.70
NewUnionFunction · 0.70
newDistinctFunction · 0.70

Tested by

no test coverage detected