(makeIter makeIterFn, conditions []traceql.Condition, definitionLevel int, keyPath, strPath, intPath, floatPath, boolPath string, allConditions bool, selectAll bool, )
| 2979 | } |
| 2980 | |
| 2981 | func createAttributeIterator(makeIter makeIterFn, conditions []traceql.Condition, |
| 2982 | definitionLevel int, |
| 2983 | keyPath, strPath, intPath, floatPath, boolPath string, |
| 2984 | allConditions bool, selectAll bool, |
| 2985 | ) (parquetquery.Iterator, error) { |
| 2986 | skipNils := &parquetquery.SkipNilsPredicate{} |
| 2987 | |
| 2988 | if selectAll { |
| 2989 | // Select all with no filtering |
| 2990 | // Levels such as resource/instrumentation/span may have no attributes. When that |
| 2991 | // occurs the columns are encoded as single null values, and the current attribute |
| 2992 | // collector reads them as Nils. We could skip them in the attribute collector, |
| 2993 | // but this is more performant because it's at the lowest level. |
| 2994 | // Alternatively, JoinIterators don't pay attention to -1 (undefined) when checking |
| 2995 | // the definition level matches. Fixing that would also work but would need wider testing first. |
| 2996 | return parquetquery.NewLeftJoinIterator(definitionLevel, |
| 2997 | []parquetquery.Iterator{ |
| 2998 | makeIter(keyPath, skipNils, "key"), |
| 2999 | }, |
| 3000 | []parquetquery.Iterator{ |
| 3001 | makeIter(strPath, skipNils, "string"), |
| 3002 | makeIter(intPath, skipNils, "int"), |
| 3003 | makeIter(floatPath, skipNils, "float"), |
| 3004 | makeIter(boolPath, skipNils, "bool"), |
| 3005 | }, |
| 3006 | &attributeCollector{}, |
| 3007 | parquetquery.WithPool(pqAttrPool)) |
| 3008 | } |
| 3009 | |
| 3010 | var ( |
| 3011 | attrKeys = []string{} |
| 3012 | attrStringPreds = []parquetquery.Predicate{} |
| 3013 | attrIntPreds = []parquetquery.Predicate{} |
| 3014 | attrFltPreds = []parquetquery.Predicate{} |
| 3015 | boolPreds = []parquetquery.Predicate{} |
| 3016 | ) |
| 3017 | for _, cond := range conditions { |
| 3018 | |
| 3019 | attrKeys = append(attrKeys, cond.Attribute.Name) |
| 3020 | |
| 3021 | switch cond.Op { |
| 3022 | case traceql.OpNone: |
| 3023 | // This means we have to scan all value columns since we don't know what type |
| 3024 | // to expect. No filtering. |
| 3025 | attrStringPreds = append(attrStringPreds, nil) |
| 3026 | attrIntPreds = append(attrIntPreds, nil) |
| 3027 | attrFltPreds = append(attrFltPreds, nil) |
| 3028 | boolPreds = append(boolPreds, nil) |
| 3029 | continue |
| 3030 | case traceql.OpExists: |
| 3031 | // Similarly scan all value types, but we can skip nils. |
| 3032 | attrStringPreds = append(attrStringPreds, skipNils) |
| 3033 | attrIntPreds = append(attrIntPreds, skipNils) |
| 3034 | attrFltPreds = append(attrFltPreds, skipNils) |
| 3035 | boolPreds = append(boolPreds, skipNils) |
| 3036 | continue |
| 3037 | } |
| 3038 |
no test coverage detected