(makeIter makeIterFn, conditions []traceql.Condition, definitionLevel int, keyPath, strPath, intPath, floatPath, boolPath string, allConditions bool, selectAll bool, )
| 2418 | } |
| 2419 | |
| 2420 | func createAttributeIterator(makeIter makeIterFn, conditions []traceql.Condition, |
| 2421 | definitionLevel int, |
| 2422 | keyPath, strPath, intPath, floatPath, boolPath string, |
| 2423 | allConditions bool, selectAll bool, |
| 2424 | ) (parquetquery.Iterator, error) { |
| 2425 | skipNils := &parquetquery.SkipNilsPredicate{} |
| 2426 | |
| 2427 | if selectAll { |
| 2428 | // Select all with no filtering |
| 2429 | // Levels such as resource/instrumentation/span may have no attributes. When that |
| 2430 | // occurs the columns are encoded as single null values, and the current attribute |
| 2431 | // collector reads them as Nils. We could skip them in the attribute collector, |
| 2432 | // but this is more performant because it's at the lowest level. |
| 2433 | // Alternatively, JoinIterators don't pay attention to -1 (undefined) when checking |
| 2434 | // the definition level matches. Fixing that would also work but would need wider testing first. |
| 2435 | return parquetquery.NewLeftJoinIterator(definitionLevel, |
| 2436 | []parquetquery.Iterator{ |
| 2437 | makeIter(keyPath, skipNils, "key"), |
| 2438 | }, |
| 2439 | []parquetquery.Iterator{ |
| 2440 | makeIter(strPath, skipNils, "string"), |
| 2441 | makeIter(intPath, skipNils, "int"), |
| 2442 | makeIter(floatPath, skipNils, "float"), |
| 2443 | makeIter(boolPath, skipNils, "bool"), |
| 2444 | }, |
| 2445 | &attributeCollector{}, |
| 2446 | parquetquery.WithPool(pqAttrPool)) |
| 2447 | } |
| 2448 | |
| 2449 | var ( |
| 2450 | attrKeys = []string{} |
| 2451 | attrStringPreds = []parquetquery.Predicate{} |
| 2452 | attrIntPreds = []parquetquery.Predicate{} |
| 2453 | attrFltPreds = []parquetquery.Predicate{} |
| 2454 | boolPreds = []parquetquery.Predicate{} |
| 2455 | ) |
| 2456 | for _, cond := range conditions { |
| 2457 | |
| 2458 | attrKeys = append(attrKeys, cond.Attribute.Name) |
| 2459 | |
| 2460 | switch cond.Op { |
| 2461 | case traceql.OpNone: |
| 2462 | // This means we have to scan all values, we don't know what type |
| 2463 | // to expect |
| 2464 | attrStringPreds = append(attrStringPreds, nil) |
| 2465 | attrIntPreds = append(attrIntPreds, nil) |
| 2466 | attrFltPreds = append(attrFltPreds, nil) |
| 2467 | boolPreds = append(boolPreds, nil) |
| 2468 | continue |
| 2469 | case traceql.OpExists: |
| 2470 | // This means we have to scan all values, we don't know what type |
| 2471 | // to expect. But we can skip nils |
| 2472 | attrStringPreds = append(attrStringPreds, skipNils) |
| 2473 | attrIntPreds = append(attrIntPreds, skipNils) |
| 2474 | attrFltPreds = append(attrFltPreds, skipNils) |
| 2475 | boolPreds = append(boolPreds, skipNils) |
| 2476 | continue |
| 2477 | } |
no test coverage detected