(makeIter makeIterFn, conditions []traceql.Condition, definitionLevel int, keyPath, strPath, intPath, floatPath, boolPath string, allConditions bool, selectAll bool, )
| 3060 | } |
| 3061 | |
| 3062 | func createAttributeIterator(makeIter makeIterFn, conditions []traceql.Condition, |
| 3063 | definitionLevel int, |
| 3064 | keyPath, strPath, intPath, floatPath, boolPath string, |
| 3065 | allConditions bool, selectAll bool, |
| 3066 | ) (parquetquery.Iterator, error) { |
| 3067 | skipNils := &parquetquery.SkipNilsPredicate{} |
| 3068 | |
| 3069 | if selectAll { |
| 3070 | // Select all with no filtering |
| 3071 | // Levels such as resource/instrumentation/span may have no attributes. When that |
| 3072 | // occurs the columns are encoded as single null values, and the current attribute |
| 3073 | // collector reads them as Nils. We could skip them in the attribute collector, |
| 3074 | // but this is more performant because it's at the lowest level. |
| 3075 | // Alternatively, JoinIterators don't pay attention to -1 (undefined) when checking |
| 3076 | // the definition level matches. Fixing that would also work but would need wider testing first. |
| 3077 | return parquetquery.NewLeftJoinIterator(definitionLevel, |
| 3078 | []parquetquery.Iterator{ |
| 3079 | makeIter(keyPath, skipNils, "key"), |
| 3080 | }, |
| 3081 | []parquetquery.Iterator{ |
| 3082 | makeIter(strPath, skipNils, "string"), |
| 3083 | makeIter(intPath, skipNils, "int"), |
| 3084 | makeIter(floatPath, skipNils, "float"), |
| 3085 | makeIter(boolPath, skipNils, "bool"), |
| 3086 | }, |
| 3087 | &attributeCollector{}, |
| 3088 | parquetquery.WithPool(pqAttrPool)) |
| 3089 | } |
| 3090 | |
| 3091 | var ( |
| 3092 | attrKeys = []string{} |
| 3093 | attrStringPreds = []parquetquery.Predicate{} |
| 3094 | attrIntPreds = []parquetquery.Predicate{} |
| 3095 | attrFltPreds = []parquetquery.Predicate{} |
| 3096 | boolPreds = []parquetquery.Predicate{} |
| 3097 | ) |
| 3098 | for _, cond := range conditions { |
| 3099 | |
| 3100 | attrKeys = append(attrKeys, cond.Attribute.Name) |
| 3101 | |
| 3102 | switch cond.Op { |
| 3103 | case traceql.OpNone: |
| 3104 | // This means we have to scan all value columns since we don't know what type |
| 3105 | // to expect. No filtering. |
| 3106 | attrStringPreds = append(attrStringPreds, nil) |
| 3107 | attrIntPreds = append(attrIntPreds, nil) |
| 3108 | attrFltPreds = append(attrFltPreds, nil) |
| 3109 | boolPreds = append(boolPreds, nil) |
| 3110 | continue |
| 3111 | case traceql.OpExists: |
| 3112 | // Similarly scan all value types, but we can skip nils. |
| 3113 | attrStringPreds = append(attrStringPreds, skipNils) |
| 3114 | attrIntPreds = append(attrIntPreds, skipNils) |
| 3115 | attrFltPreds = append(attrFltPreds, skipNils) |
| 3116 | boolPreds = append(boolPreds, skipNils) |
| 3117 | continue |
| 3118 | } |
| 3119 |
no test coverage detected