transformVars transforms all the variables to the variable at the lowest level
(doneVars map[string]varValue, path []*SubGraph)
| 1237 | |
| 1238 | // transformVars transforms all the variables to the variable at the lowest level |
| 1239 | func (sg *SubGraph) transformVars(doneVars map[string]varValue, path []*SubGraph) error { |
| 1240 | mNode := sg.MathExp |
| 1241 | mvarList := mNode.extractVarNodes() |
| 1242 | for i := range mvarList { |
| 1243 | mt := mvarList[i] |
| 1244 | curNode := doneVars[mt.Var] |
| 1245 | newMap, err := curNode.transformTo(path) |
| 1246 | if err != nil { |
| 1247 | return err |
| 1248 | } |
| 1249 | |
| 1250 | // This is the result of setting the result of count(uid) to a variable. |
| 1251 | // Treat this value as a constant. |
| 1252 | if val, ok := newMap.Get(math.MaxUint64); ok && newMap.Len() == 1 { |
| 1253 | mt.Const = val |
| 1254 | continue |
| 1255 | } |
| 1256 | |
| 1257 | mt.Val = newMap |
| 1258 | } |
| 1259 | return nil |
| 1260 | } |
| 1261 | |
| 1262 | func (sg *SubGraph) valueVarAggregation(doneVars map[string]varValue, path []*SubGraph, |
| 1263 | parent *SubGraph) error { |
no test coverage detected