(ctx context.Context, req traceql.FetchSpansRequest, _ common.SearchOptions)
| 661 | } |
| 662 | |
| 663 | func (b *walBlock) Fetch(ctx context.Context, req traceql.FetchSpansRequest, _ common.SearchOptions) (traceql.FetchSpansResponse, error) { |
| 664 | // todo: this same method is called in backendBlock.Fetch. is there anyway to share this? |
| 665 | err := checkConditions(req.Conditions) |
| 666 | if err != nil { |
| 667 | return traceql.FetchSpansResponse{}, fmt.Errorf("conditions invalid: %w", err) |
| 668 | } |
| 669 | |
| 670 | blockFlushes := b.readFlushes() |
| 671 | // collect page readers to compute totalBytesRead |
| 672 | readers := make([]*walReaderAt, 0, len(blockFlushes)) |
| 673 | iters := make([]traceql.SpansetIterator, 0, len(blockFlushes)) |
| 674 | for _, page := range blockFlushes { |
| 675 | file, err := page.file(ctx) |
| 676 | if err != nil { |
| 677 | return traceql.FetchSpansResponse{}, fmt.Errorf("error opening file %s: %w", page.path, err) |
| 678 | } |
| 679 | |
| 680 | pf := file.parquetFile |
| 681 | |
| 682 | iter, err := fetch(ctx, req, pf, pf.RowGroups(), b.meta.DedicatedColumns) |
| 683 | if err != nil { |
| 684 | return traceql.FetchSpansResponse{}, fmt.Errorf("creating fetch iter: %w", err) |
| 685 | } |
| 686 | |
| 687 | wrappedIterator := &pageFileClosingIterator{iter: iter, pageFile: file} |
| 688 | iters = append(iters, wrappedIterator) |
| 689 | readers = append(readers, file.r) |
| 690 | } |
| 691 | |
| 692 | // combine iters? |
| 693 | return traceql.FetchSpansResponse{ |
| 694 | Results: &mergeSpansetIterator{ |
| 695 | iters: iters, |
| 696 | }, |
| 697 | Bytes: func() uint64 { |
| 698 | // read value when callback is called |
| 699 | var totalBytesRead uint64 |
| 700 | for _, r := range readers { |
| 701 | totalBytesRead += r.BytesRead() |
| 702 | } |
| 703 | return totalBytesRead |
| 704 | }, |
| 705 | }, nil |
| 706 | } |
| 707 | |
| 708 | func (b *walBlock) FetchSpans(_ context.Context, _ traceql.FetchSpansRequest, _ common.SearchOptions) (traceql.FetchSpansOnlyResponse, error) { |
| 709 | return traceql.FetchSpansOnlyResponse{}, util.ErrUnsupported |
nothing calls this directly
no test coverage detected