fetch is the core logic for executing the given conditions against the parquet columns. The algorithm can be summarized as a hiearchy of iterators where we iterate related columns together and collect the results at each level into attributes, spans, and spansets. Each condition (.foo=bar) is pushe
(ctx context.Context, req traceql.FetchSpansRequest, pf *parquet.File, rowGroups []parquet.RowGroup, dc backend.DedicatedColumns)
| 1626 | // V |
| 1627 | |
| 1628 | func fetch(ctx context.Context, req traceql.FetchSpansRequest, pf *parquet.File, rowGroups []parquet.RowGroup, dc backend.DedicatedColumns) (*spansetIterator, error) { |
| 1629 | iter, err := createAllIterator(ctx, nil, req.Conditions, req.AllConditions, req.StartTimeUnixNanos, req.EndTimeUnixNanos, rowGroups, pf, dc, false, req.TraceSampler, req.SpanSampler) |
| 1630 | if err != nil { |
| 1631 | return nil, fmt.Errorf("error creating iterator: %w", err) |
| 1632 | } |
| 1633 | |
| 1634 | if req.SecondPass != nil { |
| 1635 | iter = newBridgeIterator(newRebatchIterator(iter), req.SecondPass) |
| 1636 | |
| 1637 | iter, err = createAllIterator(ctx, iter, req.SecondPassConditions, false, 0, 0, rowGroups, pf, dc, req.SecondPassSelectAll, nil, nil) |
| 1638 | if err != nil { |
| 1639 | return nil, fmt.Errorf("error creating second pass iterator: %w", err) |
| 1640 | } |
| 1641 | } |
| 1642 | |
| 1643 | return newSpansetIterator(newRebatchIterator(iter)), nil |
| 1644 | } |
| 1645 | |
| 1646 | type categorizedConditions struct { |
| 1647 | span []traceql.Condition |
no test coverage detected