(ctx context.Context, pf *parquet.File, req *tempopb.SearchRequest, rgs []parquet.RowGroup, dc backend.DedicatedColumns)
| 257 | } |
| 258 | |
| 259 | func searchParquetFile(ctx context.Context, pf *parquet.File, req *tempopb.SearchRequest, rgs []parquet.RowGroup, dc backend.DedicatedColumns) (*tempopb.SearchResponse, error) { |
| 260 | // Search happens in 2 phases for an optimization. |
| 261 | // Phase 1 is iterate all columns involved in the request. |
| 262 | // Only if there are any matches do we enter phase 2, which |
| 263 | // is to load the display-related columns. |
| 264 | |
| 265 | // Find matches |
| 266 | matchingRows, err := searchRaw(ctx, pf, req, rgs, dc) |
| 267 | if err != nil { |
| 268 | return nil, err |
| 269 | } |
| 270 | if len(matchingRows) == 0 { |
| 271 | return &tempopb.SearchResponse{Metrics: &tempopb.SearchMetrics{}}, nil |
| 272 | } |
| 273 | |
| 274 | // We have some results, now load the display columns |
| 275 | results, err := rawToResults(ctx, pf, rgs, matchingRows) |
| 276 | if err != nil { |
| 277 | return nil, err |
| 278 | } |
| 279 | |
| 280 | return &tempopb.SearchResponse{ |
| 281 | Traces: results, |
| 282 | Metrics: &tempopb.SearchMetrics{}, |
| 283 | }, nil |
| 284 | } |
| 285 | |
| 286 | func searchRaw(ctx context.Context, pf *parquet.File, req *tempopb.SearchRequest, rgs []parquet.RowGroup, dc backend.DedicatedColumns) ([]pq.RowNumber, error) { |
| 287 | iter := makePipelineWithRowGroups(ctx, req, pf, rgs, dc) |
no test coverage detected