( makeIter makeIterFn, conditions []traceql.Condition, start, end uint64, allConditions bool, _ backend.DedicatedColumns, selectAll bool, )
| 215 | } |
| 216 | |
| 217 | func createTraceIterators( |
| 218 | makeIter makeIterFn, |
| 219 | conditions []traceql.Condition, |
| 220 | start, end uint64, |
| 221 | allConditions bool, |
| 222 | _ backend.DedicatedColumns, |
| 223 | selectAll bool, |
| 224 | ) (required, optional []parquetquery.Iterator) { |
| 225 | var alwaysOptional []parquetquery.Iterator |
| 226 | |
| 227 | for _, cond := range conditions { |
| 228 | switch cond.Attribute.Intrinsic { |
| 229 | case traceql.IntrinsicTraceID: |
| 230 | if cond.Op == traceql.OpNone && cond.CallBack != nil { |
| 231 | // This is expected to quit early, so it is always optional below. |
| 232 | alwaysOptional = append(alwaysOptional, makeIter(columnPathTraceID, parquetquery.NewCallbackPredicate(cond.CallBack), columnPathTraceID)) |
| 233 | } else { |
| 234 | // This starts as optional but can be moved to required for better performance. |
| 235 | optional = append(optional, makeIter(columnPathTraceID, nil, columnPathTraceID)) |
| 236 | } |
| 237 | case traceql.IntrinsicTraceDuration: |
| 238 | optional = append(optional, makeIter(columnPathDurationNanos, nil, columnPathDurationNanos)) |
| 239 | case traceql.IntrinsicTraceStartTime: |
| 240 | optional = append(optional, makeIter(columnPathStartTimeUnixNano, nil, columnPathStartTimeUnixNano)) |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | // evaluate time range |
| 245 | // Time range filtering? |
| 246 | if start > 0 && end > 0 { |
| 247 | // Here's how we detect the span overlaps the time window: |
| 248 | // Span start <= req.End |
| 249 | // Span end >= req.Start |
| 250 | var startFilter, endFilter parquetquery.Predicate |
| 251 | startFilter = parquetquery.NewIntBetweenPredicate(0, int64(end)) |
| 252 | endFilter = parquetquery.NewIntBetweenPredicate(int64(start), math.MaxInt64) |
| 253 | |
| 254 | required = append(required, makeIter(columnPathStartTimeUnixNano, startFilter, columnPathStartTimeUnixNano)) |
| 255 | required = append(required, makeIter(columnPathEndTimeUnixNano, endFilter, columnPathEndTimeUnixNano)) |
| 256 | } |
| 257 | |
| 258 | if selectAll { |
| 259 | for intrins, entry := range intrinsicColumnLookups { |
| 260 | if entry.scope != intrinsicScopeTrace { |
| 261 | continue |
| 262 | } |
| 263 | // These intrinsics aren't included in select all because they are not |
| 264 | // useful for filtering or grouping. |
| 265 | switch intrins { |
| 266 | case traceql.IntrinsicTraceStartTime, |
| 267 | traceql.IntrinsicServiceStats: |
| 268 | continue |
| 269 | } |
| 270 | required = append(required, makeIter(entry.columnPath, nil, entry.columnPath)) |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | // If all conditions move them to required |
no test coverage detected