Fetch spansets from the block for the given TraceQL FetchSpansRequest. The request is checked for internal consistencies: operand count matches the operation, all operands in each condition are identical types, and the operand type is compatible with the operation.
(ctx context.Context, req traceql.FetchSpansRequest, opts common.SearchOptions)
| 1038 | // internal consistencies: operand count matches the operation, all operands in each condition are identical |
| 1039 | // types, and the operand type is compatible with the operation. |
| 1040 | func (b *backendBlock) Fetch(ctx context.Context, req traceql.FetchSpansRequest, opts common.SearchOptions) (traceql.FetchSpansResponse, error) { |
| 1041 | err := checkConditions(req.Conditions) |
| 1042 | if err != nil { |
| 1043 | return traceql.FetchSpansResponse{}, fmt.Errorf("conditions invalid: %w", err) |
| 1044 | } |
| 1045 | |
| 1046 | coalesceConditions(&req) |
| 1047 | |
| 1048 | pf, rr, err := b.openForSearch(ctx, opts) |
| 1049 | if err != nil { |
| 1050 | return traceql.FetchSpansResponse{}, err |
| 1051 | } |
| 1052 | |
| 1053 | rgs := rowGroupsFromFile(pf, opts) |
| 1054 | |
| 1055 | iter, err := fetch(ctx, req, pf, rgs, b.meta.DedicatedColumns) |
| 1056 | if err != nil { |
| 1057 | return traceql.FetchSpansResponse{}, fmt.Errorf("creating fetch iter: %w", err) |
| 1058 | } |
| 1059 | |
| 1060 | return traceql.FetchSpansResponse{ |
| 1061 | Results: iter, |
| 1062 | Bytes: func() uint64 { return rr.BytesRead() }, |
| 1063 | }, nil |
| 1064 | } |
| 1065 | |
| 1066 | func checkConditions(conditions []traceql.Condition) error { |
| 1067 | for _, cond := range conditions { |
nothing calls this directly
no test coverage detected