()
| 109 | } |
| 110 | |
| 111 | func (a Aggregate) validate() error { |
| 112 | if a.e == nil { |
| 113 | return nil |
| 114 | } |
| 115 | |
| 116 | if err := a.e.validate(); err != nil { |
| 117 | return err |
| 118 | } |
| 119 | |
| 120 | // aggregate field expressions require a type of a number or attribute |
| 121 | t := a.e.impliedType() |
| 122 | if t != TypeAttribute && !t.isNumeric() { |
| 123 | return fmt.Errorf("aggregate field expressions must resolve to a number type: %s", a.String()) |
| 124 | } |
| 125 | |
| 126 | if !a.e.referencesSpan() { |
| 127 | return fmt.Errorf("aggregate field expressions must reference the span: %s", a.String()) |
| 128 | } |
| 129 | |
| 130 | switch a.op { |
| 131 | case aggregateCount, aggregateAvg, aggregateMin, aggregateMax, aggregateSum: |
| 132 | default: |
| 133 | return newUnsupportedError(fmt.Sprintf("aggregate operation (%v)", a.op)) |
| 134 | } |
| 135 | |
| 136 | return nil |
| 137 | } |
| 138 | |
| 139 | func (o SpansetOperation) validate() error { |
| 140 | if err := o.LHS.validate(); err != nil { |
nothing calls this directly
no test coverage detected