(grp *groupResult, child *SubGraph)
| 128 | } |
| 129 | |
| 130 | func aggregateGroup(grp *groupResult, child *SubGraph) (types.Val, error) { |
| 131 | ag := aggregator{ |
| 132 | name: child.SrcFunc.Name, |
| 133 | } |
| 134 | for _, uid := range grp.uids { |
| 135 | idx := sort.Search(len(child.SrcUIDs.Uids), func(i int) bool { |
| 136 | return child.SrcUIDs.Uids[i] >= uid |
| 137 | }) |
| 138 | if idx == len(child.SrcUIDs.Uids) || child.SrcUIDs.Uids[idx] != uid { |
| 139 | continue |
| 140 | } |
| 141 | |
| 142 | if len(child.valueMatrix[idx].Values) == 0 { |
| 143 | continue |
| 144 | } |
| 145 | v := child.valueMatrix[idx].Values[0] |
| 146 | val, err := convertWithBestEffort(v, child.Attr) |
| 147 | if err != nil { |
| 148 | continue |
| 149 | } |
| 150 | if err := ag.Apply(val); err != nil { |
| 151 | return types.Val{}, err |
| 152 | } |
| 153 | } |
| 154 | return ag.Value() |
| 155 | } |
| 156 | |
| 157 | // formGroup creates all possible groups with the list of uids that belong to that |
| 158 | // group. |
no test coverage detected