(makeIter, makeNilIter makeIterFn, spanIterator parquetquery.Iterator, conditions []traceql.Condition, allConditions, selectAll bool)
| 2236 | } |
| 2237 | |
| 2238 | func createInstrumentationIterator(makeIter, makeNilIter makeIterFn, spanIterator parquetquery.Iterator, conditions []traceql.Condition, allConditions, selectAll bool) (parquetquery.Iterator, error) { |
| 2239 | var ( |
| 2240 | iters = []parquetquery.Iterator{} |
| 2241 | genericConditions []traceql.Condition |
| 2242 | ) |
| 2243 | |
| 2244 | for _, cond := range conditions { |
| 2245 | // Intrinsics ? |
| 2246 | switch cond.Attribute.Intrinsic { |
| 2247 | case traceql.IntrinsicInstrumentationName: |
| 2248 | pred, err := createStringPredicate(cond.Op, cond.Operands) |
| 2249 | if err != nil { |
| 2250 | return nil, err |
| 2251 | } |
| 2252 | iters = append(iters, makeIter(columnPathInstrumentationName, pred, columnPathInstrumentationName)) |
| 2253 | continue |
| 2254 | |
| 2255 | case traceql.IntrinsicInstrumentationVersion: |
| 2256 | pred, err := createStringPredicate(cond.Op, cond.Operands) |
| 2257 | if err != nil { |
| 2258 | return nil, err |
| 2259 | } |
| 2260 | iters = append(iters, makeIter(columnPathInstrumentationVersion, pred, columnPathInstrumentationVersion)) |
| 2261 | continue |
| 2262 | } |
| 2263 | |
| 2264 | // check attr not exists |
| 2265 | if cond.Op == traceql.OpNotExists { |
| 2266 | // Generic attr doesn't exist |
| 2267 | pred := parquetquery.NewIncludeNilStringEqualPredicate([]byte(cond.Attribute.Name)) |
| 2268 | iters = append(iters, makeNilIter(columnPathInstrumentationAttrKey, pred, cond.Attribute.Name)) |
| 2269 | continue |
| 2270 | } |
| 2271 | |
| 2272 | // Else: generic attribute lookup |
| 2273 | genericConditions = append(genericConditions, cond) |
| 2274 | } |
| 2275 | |
| 2276 | if selectAll { |
| 2277 | for _, entry := range intrinsicColumnLookups { |
| 2278 | if entry.scope != intrinsicScopeInstrumentation { |
| 2279 | continue |
| 2280 | } |
| 2281 | iters = append(iters, makeIter(entry.columnPath, nil, entry.columnPath)) |
| 2282 | } |
| 2283 | } |
| 2284 | |
| 2285 | attrIter, err := createAttributeIterator(makeIter, genericConditions, DefinitionLevelInstrumentationScopeAttrs, |
| 2286 | columnPathInstrumentationAttrKey, columnPathInstrumentationAttrString, columnPathInstrumentationAttrInt, columnPathInstrumentationAttrDouble, columnPathInstrumentationAttrBool, allConditions, selectAll) |
| 2287 | if err != nil { |
| 2288 | return nil, fmt.Errorf("creating instrumentation attribute iterator: %w", err) |
| 2289 | } |
| 2290 | if attrIter != nil { |
| 2291 | iters = append(iters, attrIter) |
| 2292 | } |
| 2293 | |
| 2294 | minCount := 0 |
| 2295 | if allConditions { |
no test coverage detected