MCPcopy
hub / github.com/grafana/tempo / searchParquetFile

Function searchParquetFile

tempodb/encoding/vparquet5/block_search.go:277–302  ·  view source on GitHub ↗
(ctx context.Context, pf *parquet.File, req *tempopb.SearchRequest, rgs []parquet.RowGroup, dc backend.DedicatedColumns)

Source from the content-addressed store, hash-verified

275}
276
277func searchParquetFile(ctx context.Context, pf *parquet.File, req *tempopb.SearchRequest, rgs []parquet.RowGroup, dc backend.DedicatedColumns) (*tempopb.SearchResponse, error) {
278 // Search happens in 2 phases for an optimization.
279 // Phase 1 is iterate all columns involved in the request.
280 // Only if there are any matches do we enter phase 2, which
281 // is to load the display-related columns.
282
283 // Find matches
284 matchingRows, err := searchRaw(ctx, pf, req, rgs, dc)
285 if err != nil {
286 return nil, err
287 }
288 if len(matchingRows) == 0 {
289 return &tempopb.SearchResponse{Metrics: &tempopb.SearchMetrics{}}, nil
290 }
291
292 // We have some results, now load the display columns
293 results, err := rawToResults(ctx, pf, rgs, matchingRows)
294 if err != nil {
295 return nil, err
296 }
297
298 return &tempopb.SearchResponse{
299 Traces: results,
300 Metrics: &tempopb.SearchMetrics{},
301 }, nil
302}
303
304func searchRaw(ctx context.Context, pf *parquet.File, req *tempopb.SearchRequest, rgs []parquet.RowGroup, dc backend.DedicatedColumns) ([]pq.RowNumber, error) {
305 iter := makePipelineWithRowGroups(ctx, req, pf, rgs, dc)

Callers 2

SearchMethod · 0.70
SearchMethod · 0.70

Calls 2

searchRawFunction · 0.70
rawToResultsFunction · 0.70

Tested by

no test coverage detected